Quantcast
Channel: Wsus Package Publisher
Viewing all articles
Browse latest Browse all 3825

New Post: Problem to deploy custom update on windows server 2012R2

$
0
0
Hello,
Sorry for this long absence.

Thanks WinfriedSonntag for the idea. I've write a PowerShell script to deploy any feature from the cloud or another source. And I write a bat script to install framework3.5 by a GPO at the strating of Windows.

This is my little contribution ^^

Here is the enable_feature.ps1
# author : 
# version : 1.3
# date : 31/03/2016
# description : Enable feature for windows 2012 by GPO
# Warning you can't use the c$ or d$ for the source, it fail because of the '$' caracter

Param([string]$feature,[string]$source)

$logfile=$env:temp+"/enable_feature_$feature.log"
#$virtual_drive="S:"

# Import ServerManager Module
Import-Module ServerManager
$returnCode=0

try {
    $checkFeature = Get-WindowsFeature | Where-Object {$_.Name -eq $feature}
}
catch [System.Exception] {
    "Error to get windows feature $_.Exception.Message" | Out-File -Append $logfile
    $exitCode=2
}

#check and instal feature
If ($checkFeature.Installed -ne "True" )  {  
    if ($source -ne "") {
        try {
            "Adding $feature" | Out-File -Append $logfile
            # Add-WindowsFeature $feature -source $virtual_drive+"\sxs" | Out-File -Append $logfile
            Add-WindowsFeature $feature -source $source | Out-File -Append $logfile
        }
        catch [System.Exception] {
            "Error to add Windows feature with alternative source $virtual_drive - $_.Exception.Message" | Out-File -Append $logfile
            $exitCode=22
        }
    }
    else {
        try {
            Add-WindowsFeature $feature | Out-File -Append $logfile
        }
        catch [System.Exception] {
            "Error to add Windows feature $_.Exception.Message" | Out-File -Append $logfile
            $exitCode=24
        }
    }
    #check if install correct
    $checkFeature = Get-WindowsFeature | Where-Object {
        $_.Name -eq "$feature"
    }
    If ($checkFeature.Installed -ne "True") {
        "Error to install $feature" | Out-File -Append $logfile
        $returnCode=1
    }
}
else {
    "$feature always installed!" | Out-File -Append $logfile
}

exit $returnCode
And here is the bat script to specified which feature to install : framework 3.5
@echo off
copy /Y \\YOUR DOMAIN\sysvol\YOUR DOMAIN\scripts\enable_feature.ps1 c:\
powershell c:\enable_feature.ps1 -feature "NET-Framework-Features" -source "\\YOURWSUS.YOUR DOMAIN\Windows-2012R2x64-sxs\sxs"
rem powershell c:\enable_feature.ps1 -feature "NET-Framework-Core" -source "\\YOURWSUS.YOUR DOMAIN\d$\Windows-2012R2x64-sxs\sxs"
del c:\enable_feature.ps1
And I've add a "fake" custom update, only to see if framework3.5 is correctly installed by the GPO :
I check the same registry value in the "installed" and in the "installable" :
SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5\Install
1
REG_DWORD

Result :
  • when framework3.5 is not installed, the wsus publisher said "not applicable"
  • when framework3.5 is installed, the wsus publisher said "installed"
Here the screenshots :
Image
Image
Image
Image

Regards,
Gaëtan

PS : I see CustomUpdateEngine is compiled in .Net Framework 4.0 in next Version of WPP, thanks to the author!

Viewing all articles
Browse latest Browse all 3825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>