Jump to content

Search the Community

Showing results for tags '.NET Framework 4'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Dear forum members, I try to find a solution which version of the .NET Framework 4 is installed (or not at all) on the PC. From the scriptingguy site I have made this one: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.10.0 Author: myName Script Function: Template AutoIt script. It’s very important to know which version of the .NET Framework is installed on a computer, especially when you’re working with custom applications written in-house; the Scripting Guys know from painful experience that custom applications often require a very specific version of the .NET Framework. Any version earlier - or later - and the application might not run. Because of that you might think there’s a very quick, easy way to determine which version (or versions) of the .NET Framework is installed on a computer. Well, if there is, we couldn’t find it: we were unable to locate a COM object or a specific registry key that could tell us, once and for all, which version is installed on a computer. The best we could do was this brute force method, a method which is accompanied by a caveat we’ll talk about momentarily. http://blogs.technet.com/b/heyscriptingguy/archive/2005/07/12/how-can-i-tell-which-version-of-the-net-framework-is-installed-on-a-computer.aspx #ce ---------------------------------------------------------------------------- Opt("MustDeclareVars", 1) Global $wbemFlagReturnImmediately = 0x10, _ ;DO NOT CHANGE $wbemFlagForwardOnly = 0x20 ;DO NOT CHANGE local $NetVersion1 = _GetNetVersion1() MsgBox(0, ".NET Framework ", $NetVersion1) ; debug Func _GetNetVersion1() Local $strComputer = "localhost" local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\") ; ??? ; Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") ; ? ; Local $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") ; ? ; Local $objWMIService = ObjGet("winmgmts:{(RemoteShutdown)}//" & $strComputer & "\root\CIMV2") ; ? ;Local $colItems = $objWMIService.ExecQuery("Select * from Win32_Product"); ? Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Product", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) For $objItem In $colItems If StringInStr($objItem.Name, "Microsoft .NET Framework") > 0 Then If $objItem.Version > "4.*" Then Return "Found: " & $objItem.Name & @CRLF & "Version: " & $objItem.Version Else Return "Microsoft .NET Framework v.4 not found!" EndIf EndIf Next EndFunc ;==>_GetNetVersion Don't know if this the right way to do it, never worked with the WMIService Below I found a other Autoitscript local $NetVersion2 = _GetNetVersion2() MsgBox(0, ".NET Framework ", $NetVersion2) ; debug Func _GetNetVersion2() Dim $strComputer, $objWMIService $strComputer = "." $objWMIService = ObjGet("winmgmts:{(RemoteShutdown)}//" & $strComputer & "\root\CIMV2") Local $colItems = "" $colItems = $objWMIService.ExecQuery("Select * from Win32_Product") For $objItem In $colItems Select Case StringInStr($objItem.Name, 'Microsoft .NET Framework') If $objItem.Version > "4.*" Then Return "Found: " & $objItem.Name & @CRLF & "Version: " & $objItem.Version Else Return "Microsoft .NET Framework v.4 not found!" EndIf EndSelect Next EndFunc ;==>_Read_Products Both scripts are quite slow, brute force method (loop through the collection of software products installed using .MSI files). From the >autoitscript.com/forum I found this script below but shows .NET Framework v4 while I working with 4.5.2. Other versions of .NET are not important, the only thing I want to know which version of .NET 4 is installed. ; ========================================================================================================================== ; Func _dotNetGetVersions($bOnlyInstalled=False) ; ; Function to return information on which .NET versions are/were installed. ; NOTES: No Service Pack information is retrieved, although that can be obtained using the methods ; in the MSDN link below. ; ; Also NOTE: As with anything I program (in full or part), keep the header WITH the function if used or shared. ; ; .NET Framework detection resource: ; MSDN KB318785: 'How to determine which versions and service pack levels of the Microsoft .NET Framework are installed': ; @ <a href='http://msdn.microsoft.com/en-us/kb/kbarticle.aspx?id=318785' class='bbc_url' title='External link' rel='nofollow external'>http://msdn.microsoft.com/en-us/kb/kbarticle.aspx?id=318785</a> ; ; $bOnlyInstalled = If True, it will not report on any versions that were uninstalled ; ; Returns: ; Success: An array of information, as follows: ; [0][0] = Total # found ; [x][0] = Numerical version (can be whole number or floating point [1, 1.1, 2, 3, 3.5, 4]) ; [x][1] = Full version name string - this can be used to probe further sub-version info (example: "v2.0.50727") ; [x][2] = 0 or 1 - indicates whether 'client' or normal installation is installed ; (From version 4+, there can be a client and/or a full install - though full seems to install client.) ; [x][3] = 0 or 1 - indicates whether 'full' install of the .NET component is installed (version 4+ only) ; Failure: '' and @error set: ; @error = -3 = .NET key could not be read, or .NET is not installed (the latter *most* likely) ; (@extended returns @error state from last Reg* call.) ; ; Author: Ascend4nt ; ========================================================================================================================== Func _dotNetGetVersions($bOnlyInstalled=False) Local $i=1,$iClientInstall,$iFullInstall,$iNum,$aVersions[100][4],$iTotal=0,$bVer4Found=0 Local $sKey="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP",$sSubKey ; Detect v1.0 (special key) RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\Policy\v1.0","3705") ; If value was read (key exists), and is of type REG_SZ (1 as defined in <Constants.au3>), v1.0 is installed If @error=0 And @extended=1 Then $iTotal+=1 $aVersions[$iTotal][0]=1.0 $aVersions[$iTotal][1]='v1.0.3705' $aVersions[$iTotal][2]=1 $aVersions[$iTotal][3]=1 EndIf While 1 $iClientInstall=0 $iFullInstall=0 $sSubKey=RegEnumKey($sKey,$i) If @error Then ExitLoop $i+=1 ; 'v4.0' is a deprecated version. Since it comes after 'v4' (the newer version) while enumerating, ; a simple check if 'v4' has already been found is sufficient If $sSubKey='v4.0' And $bVer4Found Then ContinueLoop $iNum=Number(StringMid($sSubKey,2)) ; cuts off at any 2nd decimal points (obviously) ; Note - one of the SubKeys is 'CDF'. Number() will return 0 in this case [we can safely ignore that] If $iNum=0 Then ContinueLoop ;~ ConsoleWrite(".NET Framework SubKey #"&$i&": "&$sSubKey&", Number extracted (0 for non-versioned items):"&$iNum&@LF) If $iNum<4 Then $iClientInstall=RegRead($sKey&'\'&$sSubKey,'Install') If $iClientInstall Then $iFullInstall=1 ; older versions were all-or-nothing I believe ;~ If @error Then $iClientInstall=0 ; (@error from $iClientInstall) -> caught below Else ; Version 4 works with one or both of these keys. One can only hope new versions keep the same organization $iFullInstall=RegRead($sKey&'\'&$sSubKey&'\Full','Install') If @error Then $iFullInstall=0 $iClientInstall=RegRead($sKey&'\'&$sSubKey&'\Client','Install') ;~ If @error Then $iClientInstall=0 ; Caught below If $iNum<5 Then $bVer4Found=True EndIf If @error Then $iClientInstall=0 If $bOnlyInstalled And $iClientInstall=0 And $iFullInstall=0 Then ContinueLoop $iTotal+=1 $aVersions[$iTotal][0]=$iNum $aVersions[$iTotal][1]=$sSubKey $aVersions[$iTotal][2]=$iClientInstall $aVersions[$iTotal][3]=$iFullInstall WEnd If $iTotal=0 Then Return SetError(-3,@error,'') $aVersions[0][0]=$iTotal ReDim $aVersions[$iTotal+1][4] Return $aVersions EndFunc ; ------- TEST ---------- #include <Array.au3> $adotNetVersions=_dotNetGetVersions() $adotNetVersions[0][0]="Main Version #" $adotNetVersions[0][1]="Full version string" $adotNetVersions[0][2]="Client/General Install?" $adotNetVersions[0][3]="Full Install?" _ArrayDisplay($adotNetVersions,'.NET versions') Somebody know a good solution, the script has to find .NET 4.* on x32 and x64 machines Regards, Mecano
×
×
  • Create New...