Skip to content

Commit

Permalink
Fix tests, minor style issues, offline CAB update (#80)
Browse files Browse the repository at this point in the history
* Update localization strings
* general-code-cleanup
* Add Drivers, Hotfix, Third Party, Upgrades classifications ID reference
* Updated offline WSUS.cab (following https://learn.microsoft.com/en-us/mem/configmgr/sum/get-started/synchronize-software-updates-disconnected)
* Add Driver Sets classifications GUID (present in recent WSUS syncs)
  • Loading branch information
Borgquite authored Jul 16, 2024
1 parent 9d4e7c1 commit 33a94a8
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated to load localization strings correctly.
- UpdateServicesServer
- Updated to load localization strings correctly.
- Internal PDT helper module
- Updated to load localization strings correctly.
- General code cleanup
- Updated Classifications ID reference with additional potential classification GUIDs

### Added

Expand Down
2 changes: 1 addition & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ Windows Server 2008 R2 SP1, Windows Server 2012 and Windows Server 2012 R2.

## Versions

Plese refer to the [Changelog](CHANGELOG.md)
Please refer to the [Changelog](CHANGELOG.md)
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Describe "Basic tests" {
}
}

Context "Wsus service is correctly configured" {
Context "Wsus service is correctly configured" {
It "Should can the informations of update service" {
{$script:wuServer = Get-WsusServer}| Should -Not -Throw
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Describe "Tests installation with all products" {
}
}

Context "Wsus service is correctly configured" {
Context "Wsus service is correctly configured" {
It "Should can the informations of update service" {
{$script:wuServer = Get-WsusServer}| Should -Not -Throw
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Describe "Basic tests" {
}
}

Context "Wsus service is correctly configured" {
Context "Wsus service is correctly configured" {
It "Should can the informations of update service" {
{$script:wuServer = Get-WsusServer}| Should -Not -Throw
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Describe "Basic tests" {
}
}

Context "Wsus service is correctly configured" {
Context "Wsus service is correctly configured" {
It "Should can the informations of update service" {
{$script:wuServer = Get-WsusServer}| Should -Not -Throw
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/Unit/MSFT_UpdateServicesServer.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ try
$script:result = $null
}

It 'calling test should not throw and mocks' {
It 'calling test should not throw and mocks' {
{ $script:result = Get-TargetResource -Ensure 'Present' -verbose } | Should -Not -Throw

Should -Invoke Get-WsusServer -Exactly 1
Expand All @@ -129,7 +129,7 @@ try
It "Products should contain right value" {
$DesiredProducts = @('Windows Server 2003','Windows Server 2008','Windows Server 2008R2','Windows Server 2012','Windows Server 2016','Windows Server 2019')

($script:result.Products |Measure-Object).Count | Should -Be $DesiredProducts.Count
($script:result.Products | Measure-Object).Count | Should -Be $DesiredProducts.Count

$DesiredProducts | ForEach-Object {
$script:result.Products | Should -Contain $_
Expand Down
8 changes: 4 additions & 4 deletions examples/dsc_configuration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ configuration allProducts {
'E0789628-CE08-4437-BE74-2495B842F43B', #DefinitionUpdates
'0FA1201D-4330-4FA8-8AE9-B877473B6441', #SecurityUpdates
'68C5B0A3-D1A6-4553-AE49-01D3A7827828', #ServicePacks
'28BC880E-0592-4CBF-8F95-C79B17911D5F' #UpdateRollUps
'28BC880E-0592-4CBF-8F95-C79B17911D5F' #UpdateRollups
)
SynchronizeAutomatically = $true
SynchronizeAutomaticallyTimeOfDay = '15:30:00'
Expand Down Expand Up @@ -88,7 +88,7 @@ configuration defaultProducts {
'E0789628-CE08-4437-BE74-2495B842F43B', #DefinitionUpdates
'0FA1201D-4330-4FA8-8AE9-B877473B6441', #SecurityUpdates
'68C5B0A3-D1A6-4553-AE49-01D3A7827828', #ServicePacks
'28BC880E-0592-4CBF-8F95-C79B17911D5F' #UpdateRollUps
'28BC880E-0592-4CBF-8F95-C79B17911D5F' #UpdateRollups
)
SynchronizeAutomatically = $true
SynchronizeAutomaticallyTimeOfDay = '15:30:00'
Expand Down Expand Up @@ -139,7 +139,7 @@ configuration onlyOneProduct {
'E0789628-CE08-4437-BE74-2495B842F43B', #DefinitionUpdates
'0FA1201D-4330-4FA8-8AE9-B877473B6441', #SecurityUpdates
'68C5B0A3-D1A6-4553-AE49-01D3A7827828', #ServicePacks
'28BC880E-0592-4CBF-8F95-C79B17911D5F' #UpdateRollUps
'28BC880E-0592-4CBF-8F95-C79B17911D5F' #UpdateRollups
)
SynchronizeAutomatically = $true
SynchronizeAutomaticallyTimeOfDay = '15:30:00'
Expand Down Expand Up @@ -190,7 +190,7 @@ configuration wildcardInProduct {
'E0789628-CE08-4437-BE74-2495B842F43B', #DefinitionUpdates
'0FA1201D-4330-4FA8-8AE9-B877473B6441', #SecurityUpdates
'68C5B0A3-D1A6-4553-AE49-01D3A7827828', #ServicePacks
'28BC880E-0592-4CBF-8F95-C79B17911D5F' #UpdateRollUps
'28BC880E-0592-4CBF-8F95-C79B17911D5F' #UpdateRollups
)
SynchronizeAutomatically = $true
SynchronizeAutomaticallyTimeOfDay = '15:30:00'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@
# Connectors = 434DE588-ED14-48F5-8EED-A15E09A991F6
# Critical Updates = E6CF1350-C01B-414D-A61F-263D14D133B4
# Definition Updates = E0789628-CE08-4437-BE74-2495B842F43B
# Driver Sets = 77835C8D-62A7-41F5-82AD-F28D1AF1E3B1
# Drivers = EBFC1FC5-71A4-4F7B-9ACA-3B9A503104A0
# Developer Kits = E140075D-8433-45C3-AD87-E72345B36078
# Feature Packs = B54E7D24-7ADD-428F-8B75-90A396FA584F
# Guidance = 9511D615-35B2-47BB-927F-F73D8E9260BB
# Hotfix = 5EAEF3E6-ABB0-4192-9B26-0FD955381FA9
# Security Updates = 0FA1201D-4330-4FA8-8AE9-B877473B6441
# Service Packs = 68C5B0A3-D1A6-4553-AE49-01D3A7827828
# Third Party = 871A0782-BE12-A5C4-C57F-1BD6D9F7144E
# Tools = B4832BD8-E735-4761-8DAF-37F882276DAB
# Update Rollups = 28BC880E-0592-4CBF-8F95-C79B17911D5F
# Updates = CD5FFD1E-E932-4E3A-BF74-18BF0B1BBD83
# Upgrades = 3689BDC8-B205-4AF4-8D4A-A63924C5E9D5


# Load Common Module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
class MSFT_UpdateServicesCleanup : OMI_BaseResource
{
[Key, Description("An enumerated value that describes if the WSUS cleanup task exists.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
[Write, Description("Decline updates that have not been approved fo 30 days or more, are not currently needed by any clients, and are superseded by an approved update.")] Boolean DeclineSupersededUpdates;
[Write, Description("Decline updates that have not been approved for 30 days or more, are not currently needed by any clients, and are superseded by an approved update.")] Boolean DeclineSupersededUpdates;
[Write, Description("Decline updates that aren't approved and have been expired by Microsoft.")] Boolean DeclineExpiredUpdates;
[Write, Description("Delete updates that are expired and have not been approved for 30 days or more, and delete older update revisions that have not been approved for 30 days or more.")] Boolean CleanupObsoleteUpdates;
[Write, Description("Compress updates.")] Boolean CompressUpdates;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@
# Connectors = 434DE588-ED14-48F5-8EED-A15E09A991F6
# Critical Updates = E6CF1350-C01B-414D-A61F-263D14D133B4
# Definition Updates = E0789628-CE08-4437-BE74-2495B842F43B
# Driver Sets = 77835C8D-62A7-41F5-82AD-F28D1AF1E3B1
# Drivers = EBFC1FC5-71A4-4F7B-9ACA-3B9A503104A0
# Developer Kits = E140075D-8433-45C3-AD87-E72345B36078
# Feature Packs = B54E7D24-7ADD-428F-8B75-90A396FA584F
# Guidance = 9511D615-35B2-47BB-927F-F73D8E9260BB
# Hotfix = 5EAEF3E6-ABB0-4192-9B26-0FD955381FA9
# Security Updates = 0FA1201D-4330-4FA8-8AE9-B877473B6441
# Service Packs = 68C5B0A3-D1A6-4553-AE49-01D3A7827828
# Third Party = 871A0782-BE12-A5C4-C57F-1BD6D9F7144E
# Tools = B4832BD8-E735-4761-8DAF-37F882276DAB
# Update Rollups = 28BC880E-0592-4CBF-8F95-C79B17911D5F
# Updates = CD5FFD1E-E932-4E3A-BF74-18BF0B1BBD83
# Upgrades = 3689BDC8-B205-4AF4-8D4A-A63924C5E9D5

# Load Common Module
$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'
Expand Down
Binary file modified source/DSCResources/MSFT_UpdateServicesServer/WSUS.cab
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ GettingWsusServer = Getting WSUS server.
WSUSConfigurationFailed = WSUS configuration failed.
WsusEnsureValue = WSUS server is {0}.
GettingWsusConfig = Getting WSUS server configuration.
GettingWsusSubscription = Getting WUSS server subscription.
GettingWsusSubscription = Getting WSUS server subscription.
GettingWsusSQLServer = Getting WSUS SQL server.
SQLServerName = WSUS Server SQL Server is {0}.
GetWSUSContentDir = Getting WSUSServer content directory.
GetWSUSContentDir = Getting WSUS Server content directory.
WsusContentDir = WSUS Server content directory is {0}.
GetWsusImproveProgram = Getting WSUSServer update improvement program.
GetWsusImproveProgram = Getting WSUS Server update improvement program.
ImprovementProgram = WSUS Server content update improvement program is {0}.
GetUpstreamServer = Getting WSUS upstream server.
UpstreamServer = WSUS Server upstream server is {0}, port {1}, use SSL {2}, replica {3}.
Expand All @@ -22,15 +22,15 @@ GettingWsusClassifications = Getting WSUS Server Classifications.
WsusClassifications = WSUS Server Classifications are {0}.
GettingWsusProducts = Getting WSUS Server products.
WsusProducts = WSUS Server products are {0}.
GettingWsusSyncConfig = Getting WSUSServer synchronization settings.
GettingWsusSyncConfig = Getting WSUS Server synchronization settings.
WsusSyncAuto = WSUS Server synchronize automatically is {0}.
WsusSyncAutoTimeOfDay = WSUS Server synchronize automatically time of day is {0}.
WsusSyncPerDay = WSUSServer number of synchronizations per day is {0}.
WsusClientTargetingMode = WSUSServer client targeting mode is {0}.
WsusSyncPerDay = WSUS Server number of synchronizations per day is {0}.
WsusClientTargetingMode = WSUS Server client targeting mode is {0}.
RunningWsusPostInstall = Running WSUS Post Install tasks.
ResolveWsusUtilExePath = WsusUtil.exe path is {0}.
WsusUtilArgs = WsusUtil.exe {0}.
ConfiguringWsus = Configuring Wsus.
ConfiguringWsus = Configuring WSUS.
CheckPreviousConfig = Check for previous configuration change.
ConfiguringUpdateImprove= Configuring WSUS Update Improvement Program.
ConfiguringUpstreamServer= Configuring WSUS Upstream Server.
Expand Down Expand Up @@ -69,7 +69,7 @@ ProxyBasicAuthTestFailed= Proxy Server Basic Authentication test failed.
ProxyCredSetTestFailed = Proxy Server Credential test failed - credential set.
LanguageAsStrTestFailed = Languages test failed (evaluated as single string).
LanguageSetTestFailed = Languages test failed.
TestGetWsusServer = Test Products failed, no wsusserver found.
TestGetWsusServer = Test Products failed, no WSUS Server found.
GetAllProductForTest = Getting all products.
GetWildCardProductForTest = Getting all products based on wildcard : {0}
GetNameProductForTest = Getting products based on name : {0}
Expand Down
2 changes: 1 addition & 1 deletion source/Modules/PDT/PDT.psm1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'
Import-Module -Name $script:resourceHelperModulePath -ErrorAction Stop
$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US' -FileName 'PDT.strings.psd1'
$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'

# New-InvalidArgumentError
# New-InvalidArgumentException -ArgumentName 'Action' -Message $errorMessage
Expand Down

0 comments on commit 33a94a8

Please sign in to comment.