$net= (Get-WmiObject win32_product | where {$_.name-like'*Framework*'}).version
if ($net-gt'4.5.5120*') {start-sleep-s 1} ELSE {
$call1="c:\program files\medconsource\NDP452-KB2901907-x86-x64-AllOS-ENU.exe"
$arg1='/norestart /q'
Start-Process$call1$arg1-NoNewWindow-Wait
$dt2=Get-Date
$msg2="Net Framework 4.5.51209 was installed :: $dt2"
$msg2 | Out-File'c:\windows\mgh\logs\MedConNetFramework.txt'
Start-Sleep-s 5
Restart-Computer}
In the above code everything works except the restart-computer command. I've run this on a few different machines that have older versions of .net framework and the new version does get installed and the .TXT file does get created and written too but the reboot never happens. Does it not like being inside of a Loop?