Hello,
I posted on another thread, but thought I should create a separate topic for this instead.
So, I have written a custom Script resource to install .net 4.5.2. The steps in the SetScript portion work when executed in Powershell.
When run under DSC, however, the .Net installer does not get invoked. I’ve watched Task Manager to make sure.
I’ve tried 3 different ways to invoke the installer, you will see that 2 of them are currently commented out.
Since the silent install of .net 4.5.2, when invoked, returns immediately, I’ve included a check to determine when the install is completed.
Again, this all works outside of DSC.
Help Please?
(pre)
SetScript = {
$filename = “NDP452-KB2901907-x86-x64-AllOS-ENU.exe”
$httpdownload = “http://download.microsoft.com/download/E/2/1/E21644B5-2DF2-47C2-91BD-63C560427900/NDP452-KB2901907-x86-x64-AllOS-ENU.exe”
$NetBuildVersion = “379893”
$DnsDomain = (Get-WmiObject Win32_ComputerSystem).domain
write-verbose "DnsDomain: $DnsDomain"
switch -wildcard ($DnsDomain)
{
"lab*" { $binpath="\\chelchengat10\public\FileShare\dotNetRedist\$filename"}
"labtest*" { $binpath="\\chclappadfs02\cct_ops\DeploymentAutomation\bin\hotfixes\$filename"}
default {$binpath="\\n\a"}
}
if (!(test-path $binpath)){
invoke-webrequest $httpdownload -OutFile C:\binroot\$filename
$binpath="c:\binroot\$filename"
}
write-verbose "Install Net 4.5.2 from $binpath"
write-verbose "Executing $binpath /q /norestart"
sleep 5
#Start-Process -FilePath $binpath -ArgumentList "/q /norestart" -Wait
#Invoke-Expression -Command "$binpath /q /norestart"
&$binpath "/q" "/norestart"
while ($isInstalled -ne $true){
if (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' | %{$_ -match 'Release'}){
if (( Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full').Release -le $NetBuildVersion){$isInstalled = $false}else{$isInstalled=$true}
}
write-verbose "Net 4.5.2 Installed Yet?: $isInstalled"
sleep 5
}
}(/pre)