diff --git a/DSCPullServerSetup/PublishModulesAndMofsToPullServer.psm1 b/DSCPullServerSetup/PublishModulesAndMofsToPullServer.psm1 new file mode 100644 index 000000000..5116f3a58 --- /dev/null +++ b/DSCPullServerSetup/PublishModulesAndMofsToPullServer.psm1 @@ -0,0 +1,147 @@ +<# +.Synopsis + Package DSC modules and mof configuration document and publish them on enterprise DSC pull server in the required format +.DESCRIPTION + Uses Publish-DSCModulesAndMofs cmdlet to package DSC modules into zip files with the version info. If + Publishes the zip modules on "$env:ProgramFiles\WindowsPowerShell\DscService\Modules" + Publishes all mof configuration documents that present in $Source folder on "$env:ProgramFiles\WindowsPowerShell\DscService\Configuration" + Use $Force to overwrite the version of the module that exists in powershell module path with the version from $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 +{ +param( + +[Parameter(Mandatory=$True)] +[string]$Source = $pwd, # 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. +[switch]$Force, #switch to overwrite the module in PSModulePath with the version provided in $Sources +[string[]]$ModuleNameList # Package and publish the modules listed in $ModuleNameList based on powershell module path content + +) + +#Create a 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! +Write-Host "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 $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 +Write-Host "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(($listModuleNames -eq $null) -or ($listModuleNames.Count -eq 0)) + { + Write-Host "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 + Compress-Archive -Path "$path\*" -DestinationPath "$source.zip" -Verbose -Force + $version = $moduleVersion.Version.ToString() + $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 ps module 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 $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 $item.FullName -Recurse -Force -Destination "$env:ProgramFiles\WindowsPowerShell\Modules" -Verbose + } + else + { + Write-Host "Skipping module overwrite. Module with the name $name already exists. 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" -Fore Red + } + $modules+= @("$name") + } + #Package the module in $destination + CreateZipFromPSModulePath -listModuleNames $modules -destination $destination +} + + +# Deploy modules to the pullsever 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))) + { + Copy "$source\*.zip*" $moduleRepository -Force -Verbose + } + else + { + Write-Host "Copying modules to pullserver module repository skipped because the machine is not a server sku or Pull server endpoint is not deployed." -Fore Yellow + } + +} + +# function deploy configuratoin and thier checksum. +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)) ) + { + Copy-Item "$source\*.mof*" $mofRepository -Force -Verbose + } + else + { + Write-Host "Copying configuration(s) to pullserver configuration repository skipped because the machine is not a server sku or Pull server endpoint is not deployed." -Fore Yellow + } +} +Export-ModuleMember -Function Publish-DSCModuleAndMof diff --git a/DSCPullServerSetup/README.md b/DSCPullServerSetup/README.md new file mode 100644 index 000000000..924cac1c6 Binary files /dev/null and b/DSCPullServerSetup/README.md differ diff --git a/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.Schema.mof b/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.Schema.mof index c75dde570..b32eeb4b2 100644 --- a/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.Schema.mof +++ b/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.Schema.mof @@ -9,7 +9,6 @@ class MSFT_xDSCWebService : OMI_BaseResource [write,ValueMap{"Started","Stopped"},Values{"Started", "Stopped"}] string State; [write] string ModulePath; [write] string ConfigurationPath; - [write] boolean IsComplianceServer; [read] string DSCServerUrl; [write] string RegistrationKeyPath; [write] boolean AcceptSelfSignedCertificates; diff --git a/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.psm1 b/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.psm1 index a4c1d9b9c..f0471566d 100644 --- a/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.psm1 +++ b/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.psm1 @@ -94,7 +94,7 @@ function Set-TargetResource [string]$EndpointName, # Port number of the DSC Pull Server IIS Endpoint - [Uint32]$Port = $( if ($IsComplianceServer) { 7070 } else { 8080 } ), + [Uint32]$Port = 8080, # Physical path for the IIS Endpoint on the machine (usually under inetpub) [string]$PhysicalPath = "$env:SystemDrive\inetpub\$EndpointName", @@ -116,14 +116,11 @@ function Set-TargetResource # Location on the disk where the Configuration is stored [string]$ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration", - # Is the endpoint for a DSC Compliance Server - [boolean]$IsComplianceServer, - # 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 + [boolean]$AcceptSelfSignedCertificates = $true ) # Initialize with default values @@ -150,41 +147,18 @@ function Set-TargetResource $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" - # Update only if Compliance Server install is requested - if ($IsComplianceServer) - { - $webConfigFileName = "$pathPullServer\PSDSCComplianceServer.config" - $svcFileName = "$pathPullServer\PSDSCComplianceServer.svc" - $pswsMofFileName = "$pathPullServer\PSDSCComplianceServer.mof" - $pswsDispatchFileName = "$pathPullServer\PSDSCComplianceServer.xml" - } - - # check for the existance of Windows authentication, this is needed for the Compliance Server - if(($Ensure -eq "Present")) - { - Write-Verbose "Check IIS Windows Authentication" - # only important if Present, Get-WindowsFeature works under 2008 R2 and newer - if ((Get-WindowsFeature -name Web-Windows-Auth | Where Installed).count -eq 0) - { - # enable the feature - # Checking for Windows Server 2008 R2: - if([Environment]::OSVersion.Version.ToString().StartsWith("6.1.")) - { - Add-WindowsFeature -Name Web-Windows-Auth - } - else - { - Install-WindowsFeature -Name Web-Windows-Auth - } - } - } - # ============ Absent block to remove existing site ========= if(($Ensure -eq "Absent")) { @@ -200,7 +174,6 @@ function Set-TargetResource return } # =========================================================== - Write-Verbose "Create the IIS endpoint" PSWSIISEndpoint\New-PSWSEndpoint -site $EndpointName ` @@ -223,68 +196,67 @@ function Set-TargetResource 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 - #ESE database is not present in current build - PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "dbprovider" -value $jet4provider - PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "dbconnectionstr" -value $jet4database + PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "dbprovider" -value $eseprovider + PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "dbconnectionstr"-value $esedatabase Set-BindingRedirectSettingInWebConfig -path $PhysicalPath } else { - Write-Verbose "Set values into the web.config that define the repository for non-BLUE Downlevel OS" - $repository = Join-Path "$rootDataPath" "Devices.mdb" - Copy-Item "$pathPullServer\Devices.mdb" $repository -Force + if($isDownlevelOfBlue) + { + Write-Verbose "Set values into the web.config that define the repository for non-BLUE Downlevel OS" + $repository = Join-Path "$rootDataPath" "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 - } + 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" - if ($IsComplianceServer) - { - Write-Verbose "Compliance Server: Set values into the web.config that indicate this is the admin endpoint" - PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "AdminEndPoint" -value "true" + PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "dbprovider" -value $eseprovider + PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "dbconnectionstr"-value $esedatabase + } } - else - { - 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 $rootDataPath -itemType "directory" -Force - - $repository = Join-Path $rootDataPath "Devices.mdb" - Copy-Item "$pathPullServer\Devices.mdb" $repository -Force + Write-Verbose "Pull Server: Set values into the web.config that indicate the location of repository, configuration, modules" - $null = New-Item -path "$ConfigurationPath" -itemType "directory" -Force + # Create the application data directory calculated above + $null = New-Item -path $rootDataPath -itemType "directory" -Force - PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "ConfigurationPath" -value $ConfigurationPath + $repository = Join-Path $rootDataPath "Devices.mdb" + Copy-Item "$pathPullServer\Devices.mdb" $repository -Force - $null = New-Item -path "$ModulePath" -itemType "directory" -Force + $null = New-Item -path "$ConfigurationPath" -itemType "directory" -Force - PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "ModulePath" -value $ModulePath + PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "ConfigurationPath" -value $ConfigurationPath - $null = New-Item -path "$RegistrationKeyPath" -itemType "directory" -Force + $null = New-Item -path "$ModulePath" -itemType "directory" -Force - PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "RegistrationKeyPath" -value $RegistrationKeyPath + PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "ModulePath" -value $ModulePath - 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 + $null = New-Item -path "$RegistrationKeyPath" -itemType "directory" -Force - & $script:appCmd install module /name:"IISSelfSignedCertModule(32bit)" /image:$env:windir\SysWOW64\inetsrv\IISSelfSignedCertModule.dll /add:false /lock:false - & $script:appCmd add module /name:"IISSelfSignedCertModule(32bit)" /app.name:"PSDSCPullServer/" - } - else + 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 + & $script:appCmd add module /name:"IISSelfSignedCertModule(32bit)" /app.name:"PSDSCPullServer/" + } + else + { + if($AcceptSelfSignedCertificates -and ($AcceptSelfSignedCertificates -eq $false)) { - if($AcceptSelfSignedCertificates -and ($AcceptSelfSignedCertificates -eq $false)) - { - & $script:appCmd delete module /name:"IISSelfSignedCertModule(32bit)" /app.name:"PSDSCPullServer/" - } + & $script:appCmd delete module /name:"IISSelfSignedCertModule(32bit)" /app.name:"PSDSCPullServer/" } } } @@ -301,7 +273,7 @@ function Test-TargetResource [string]$EndpointName, # Port number of the DSC Pull Server IIS Endpoint - [Uint32]$Port = $( if ($IsComplianceServer) { 7070 } else { 8080 } ), + [Uint32]$Port = 8080, # Physical path for the IIS Endpoint on the machine (usually under inetpub) [string]$PhysicalPath = "$env:SystemDrive\inetpub\$EndpointName", @@ -323,13 +295,10 @@ function Test-TargetResource # Location on the disk where the Configuration is stored [string]$ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration", - # Is the endpoint for a DSC Compliance Server - [boolean]$IsComplianceServer, - # Location on the disk where the RegistrationKeys file is stored [string]$RegistrationKeyPath, - # Are self-signed certs being accepted for client auth. + # Are self-signed certs being accepted for client auth. [boolean]$AcceptSelfSignedCertificates ) @@ -361,19 +330,6 @@ function Test-TargetResource } # the other case is: Ensure and exist, we continue with more checks - # check for the existance of Windows authentication, this is needed for the Compliance Server - if(($Ensure -eq "Present")) - { - Write-Verbose "Check IIS Windows Authentication" - # only important if Present, Get-WindowsFeature works under 2008 R2 and newer - if ((Get-WindowsFeature -name Web-Windows-Auth | Where Installed).count -eq 0) - { - $DesiredConfigurationMatch = $false - Write-Verbose "Required Windows authentication is not installed, does not match the desired state." - break - } - } - Write-Verbose "Check Port" $actualPort = $website.bindings.Collection[0].bindingInformation.Split(":")[1] if ($Port -ne $actualPort) diff --git a/DSCResources/MSFT_xRemoteFile/MSFT_xRemoteFile.psm1 b/DSCResources/MSFT_xRemoteFile/MSFT_xRemoteFile.psm1 index c6568808f..5c4a37b68 100644 --- a/DSCResources/MSFT_xRemoteFile/MSFT_xRemoteFile.psm1 +++ b/DSCResources/MSFT_xRemoteFile/MSFT_xRemoteFile.psm1 @@ -191,8 +191,10 @@ function Set-TargetResource { $downloadedFile = Get-Item $DestinationPath $lastWriteTime = $downloadedFile.LastWriteTimeUtc + $filesize = $downloadedFile.Length $inputObject = @{} $inputObject["LastWriteTime"] = $lastWriteTime + $inputObject["FileSize"] = $filesize Update-Cache -DestinationPath $DestinationPath -Uri $Uri -InputObject $inputObject } } @@ -242,7 +244,7 @@ function Test-TargetResource # 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)) + if ($cache -ne $null -and ($cache.LastWriteTime -eq $file.LastWriteTimeUtc) -and ($cache.FileSize -eq $file.Length)) { Write-Debug "Cache reflects current state. No need for downloading file." $fileExists = $true diff --git a/Examples/PullServerDeploymentVerificationTest/PullServerSetupTests.ps1 b/Examples/PullServerDeploymentVerificationTest/PullServerSetupTests.ps1 new file mode 100644 index 000000000..97ce21f4a --- /dev/null +++ b/Examples/PullServerDeploymentVerificationTest/PullServerSetupTests.ps1 @@ -0,0 +1,135 @@ + +<# + * + * Once you setup your pullserver(V2), run the following set of tests on the pullserver machine to verify if the pullserver is setup properly and ready to go. + * This test assumes default values are used during deployment for the location of web.config and pull server URL. + * If default values are not used during deployment , please update these values in the 'BeforeAll' block accordingly. + * + #> + + +Describe PullServerInstallationTests{ + +BeforeAll{ + + # UPDATE THE PULLSERVER URL, If it is different from the default value. + $pullserverURL = "http://$(hostname):8080/PSDSCPullServer/PSDSCPullserver.svc" + + # UPDATE THE LOCATION OF WEB.CONFIG, if it is differnet from the default path. + $script:defaultPullServerConfigFile = "$($env:SystemDrive)\inetpub\wwwroot\psdscpullserver\web.config" + + $skip = $false + if (-not (Test-Path $defaultPullServerConfigFile)) + { + $skip = $true + Write-Error "No pullserver web.config found." -ErrorAction Stop + } + $script:webConfigXml = [xml](cat $script:defaultPullServerConfigFile) + + # RegKey info. + $regFileName = "RegistrationKeys.txt" + $regKeyElement = $webConfigXml.SelectNodes("//appSettings/add[@key = 'RegistrationKeyPath']") + $fullRegKeyPath = Join-Path $regKeyElement.value $regFileName + $regKeyContent = cat $fullRegKeyPath + + # Configuration repository info. + $configurationPathElement = $webConfigXml.SelectNodes("//appSettings/add[@key = 'ConfigurationPath']") + $script:configurationRepository = $configurationPathElement.value + +} + +It "Verify RegistrationKeyFile exist" -skip:$skip{ + + $regKey = $webConfigXml.SelectNodes("//appSettings/add[@key = 'RegistrationKeyPath']") + + if (Test-path (Join-Path $regKey.value $regFileName)){ + Write-Verbose "Registration key file found." + } + else + { + throw "RegistrationKeyFile NOT found. Make sure registration key file is placed on the location specified on the web.config of the pullserver." + } + } + +<# + # Verify module and configuration repository referenced on the web.config file exist. + #> + It "Verify configuration and module repository folders exist" -skip:$skip{ + + $modulePathElement = $webConfigXml.SelectNodes("//appSettings/add[@key = 'ModulePath']") + Test-Path ($modulePathElement.value) | Should Be $true "Module repository path referenced on web.config does not exist on the disk" + Test-Path $script:configurationRepository | Should Be $true "Module repository path referenced on web.config does not exist on the disk" +} + +<# +# +# Verify the server URL is up and running. +#> + It "Verify server is up and running" -skip:$skip{ + $response = Invoke-WebRequest -Uri $pullserverURL -UseBasicParsing + $response.StatusCode | Should Be 200 "Server response should be ok" + } + + <# + # Verify pull works on the current evironement by pulling a (No-OP) configuration from the pullserver. + # + #> + It "Verify pull end to end works" -skip:$skip{ + +# Sample test meta-configuration +$configName = "PullServerSetUpTest" +[DscLocalConfigurationManager()] +Configuration PullServerSetUpTestMetaConfig +{ + Settings + { + RefreshMode = "PULL" + + } + ConfigurationRepositoryWeb ConfigurationManager + { + ServerURL = $pullserverURL + AllowUnsecureConnection = $true # Remove this if you are using https + RegistrationKey = $regKeyContent + ConfigurationNames = @($configName) + } + +} + +PullServerSetUpTestMetaConfig -OutputPath .\PullServerSetUpTestMetaConfig +slcm -path .\PullServerSetUpTestMetaConfig -Verbose -force + + +$name = glcm |% ConfigurationDownloadManagers|% ConfigurationNames +$name | Should Be $configName + + +# Sample test configuration +Configuration NoOpConfig +{ + Import-DscResource –ModuleName 'PSDesiredStateConfiguration' + Node ($configName) + { + Script script + { + GetScript = "@{}" + SetScript = "{}" + TestScript = ‘if ($false) { return $true } else {return $false}‘ + } + } +} + +# Create a mof file copy it to +NoOpConfig -OutputPath $configurationRepository -Verbose + +# Create checksum +New-DscChecksum $configurationRepository -Verbose -Force + +# pull configuration from the server. +Update-DscConfiguration -Wait -Verbose + +$confignameSet = Get-DscConfiguration | % ConfigurationName +$confignameSet | Should Be "NoOpConfig" "Configuration is not set properly" + } + +} \ No newline at end of file diff --git a/README.md b/README.md index b1206d0fa..82f45e191 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ If the **DestinationType** is set to `Directory` (default), then the ZIP file sp * **PhysicalPath**: Folder location where the content of the web service resides. * **State**: State of the web service: { Started | Stopped } * **ModulePath**: Folder location where DSC resources are stored. -* **ConfiguraitonPath**: Folder location where DSC configurations are stored. +* **ConfigurationPath**: Folder location where DSC configurations are stored. * **IsComplianceServer**: Determines whether the web service endpoint exposes compliance data. * **Ensure**: Ensures that the web service is **Present** or **Absent** @@ -120,7 +120,7 @@ Local accounts may be specified in one of the following ways: * The account name scoped to the explicit machine name (eg. myserver\users or myserver\username). * The account name scoped using the explicit local machine qualifier (eg. .\users or .\username). -Domain members may be specified using domain\name or Universal Principal Name (UPN) formatting. The following illustrates the various formats +Domain members may be specified using domain\name or User Principal Name (UPN) formatting. The following illustrates the various formats * Domain joined machines: mydomain\myserver or myserver@mydomain.com * Domain user accounts: mydomain\username or username@mydomain.com @@ -164,6 +164,13 @@ Note: _the xWindowsOptionalFeature is only supported on Windows client or Window ### Unreleased +### 3.8.0.0 + +* Added Pester tests to validate pullserver deployement. +* Removed Compliance Server deployment from xWebservice resource. Fixed database provider selection issue depending on OS flavor +* Added Publish-DSCModuleAndMof cmdlet to package DSC modules and mof and publish them on DSC enterprise pull server +* xRemoteFile resource: Added size verification in cache + ### 3.7.0.0 * xService: @@ -293,3 +300,7 @@ This configuration will install a .msi package and verify the package using the ### Sample1.ps4 installs a package that uses an .exe file This configuration will install a .exe package and verify the package using the product ID and package name and requires credentials to read the share and install the package. It also uses custom registry values to check for the package presence. + +### Pester tests to validate pullserver deployement. + +[Pullserver Validation Tests](Examples/PullServerDeploymentVerificationTest) diff --git a/appveyor.yml b/appveyor.yml index d9b67ed71..72eeb2bdb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ #---------------------------------# # environment configuration # #---------------------------------# -version: 3.7.{build}.0 +version: 3.8.{build}.0 install: - cinst -y pester - git clone https://github.com/PowerShell/DscResource.Tests @@ -41,7 +41,7 @@ deploy_script: # Creating project artifact $stagingDirectory = (Resolve-Path ..).Path $manifest = Join-Path $pwd "xPSDesiredStateConfiguration.psd1" - (Get-Content $manifest -Raw).Replace("3.7.0.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest + (Get-Content $manifest -Raw).Replace("3.8.0.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest $zipFilePath = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip" Add-Type -assemblyname System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFilePath) diff --git a/xPSDesiredStateConfiguration.psd1 b/xPSDesiredStateConfiguration.psd1 index 0d54b1279..ead62b5bf 100644 --- a/xPSDesiredStateConfiguration.psd1 +++ b/xPSDesiredStateConfiguration.psd1 @@ -1,6 +1,6 @@ @{ # Version number of this module. -ModuleVersion = '3.7.0.0' +ModuleVersion = '3.8.0.0' # ID used to uniquely identify this module GUID = 'cc8dc021-fa5f-4f96-8ecf-dfd68a6d9d48' @@ -31,6 +31,9 @@ FunctionsToExport = '*' # Cmdlets to export from this module CmdletsToExport = '*' +#Root module +RootModule = 'DSCPullServerSetup\PublishModulesAndMofsToPullServer.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 = @{