@@ -730,6 +730,56 @@ function Remove-Capability {
730730 }
731731}
732732
733+ function Add-Capability {
734+ # Add a Windows capability
735+ [CmdletBinding (SupportsShouldProcess = $true )]
736+ param ($Capability )
737+
738+ if ($Capability.Count -ge 1 ) {
739+ foreach ($Item in $Capability ) {
740+ try {
741+ if ($PSCmdlet.ShouldProcess ($Item , " Add-WindowsCapability" )) {
742+ $params = @ {
743+ Name = $Item
744+ Online = $true
745+ }
746+ Add-WindowsCapability @params | Out-Null
747+ Write-LogFile - Message " Add capability: $ ( $Item ) "
748+ }
749+ }
750+ catch {
751+ Write-LogFile - Message $_.Exception.Message - LogLevel 3
752+ }
753+ }
754+ }
755+ }
756+
757+ function Add-Feature {
758+ # Add a Windows feature
759+ [CmdletBinding (SupportsShouldProcess = $true )]
760+ param ($Feature )
761+
762+ if ($Feature.Count -ge 1 ) {
763+ $Feature | ForEach-Object { Get-WindowsOptionalFeature - Online - FeatureName $_ } | `
764+ ForEach-Object {
765+ try {
766+ if ($PSCmdlet.ShouldProcess ($_.FeatureName , " Enable-WindowsOptionalFeature" )) {
767+ $params = @ {
768+ FeatureName = $_.FeatureName
769+ Online = $true
770+ NoRestart = $true
771+ }
772+ Enable-WindowsOptionalFeature @params | Out-Null
773+ Write-LogFile - Message " Add feature: $ ( $_.FeatureName ) "
774+ }
775+ }
776+ catch {
777+ Write-LogFile - Message $_.Exception.Message - LogLevel 3
778+ }
779+ }
780+ }
781+ }
782+
733783function Remove-Package {
734784 # Remove AppX packages
735785 [CmdletBinding (SupportsShouldProcess = $true )]
@@ -1185,4 +1235,31 @@ function Set-Shortcut {
11851235 }
11861236}
11871237
1188- Export-ModuleMember - Function *
1238+ Export-ModuleMember - Function ' Get-Symbol' ,
1239+ ' Get-Platform' ,
1240+ ' Get-Model' ,
1241+ ' Get-OSName' ,
1242+ ' Get-SettingsContent' ,
1243+ ' Write-LogFile' ,
1244+ ' Set-RegistryKeyOwner' ,
1245+ ' Set-Registry' ,
1246+ ' Remove-RegistryPath' ,
1247+ ' Set-DefaultUserProfile' ,
1248+ ' Copy-File' ,
1249+ ' New-Directory' ,
1250+ ' Remove-Path' ,
1251+ ' Add-Capability' ,
1252+ ' Add-Feature' ,
1253+ ' Remove-Feature' ,
1254+ ' Remove-Capability' ,
1255+ ' Remove-Package' ,
1256+ ' Get-CurrentUserSid' ,
1257+ ' Restart-NamedService' ,
1258+ ' Start-NamedService' ,
1259+ ' Stop-NamedService' ,
1260+ ' Install-SystemLanguage' ,
1261+ ' Set-SystemLocale' ,
1262+ ' Set-TimeZoneUsingName' ,
1263+ ' Test-IsOobeComplete' ,
1264+ ' Copy-RegExe' ,
1265+ ' Set-Shortcut'
0 commit comments