In the previous post I used some C# code to detect if bootworks was installed prior to installing full disk encryption. That all works well provided the appropriate .Net framework is installed. Unfortunately with a freshly re-imaged computer there is no .Net framework in the base image causing the bootworks detection to bomb out.
After a bit of googling I came up with this small script to gather all the installed .Net versions and a support function to test for a particular release version. The same thing could be accomplished using a registry key as described by Aaron Stebner’s blog post.
option explicit 'Detect which versions of DotNet Framework are installed. 'From Microsoft KB Article http://support.microsoft.com/kb/318785/ 'By NetworkNerd 3/11/2009 Const WindowsFolder = 0 Const SystemFolder = 1 Const TemporaryFolder = 2 const DOTNET_10 = "v1.0.3705" const DOTNET_11 = "v1.1.4322" const DOTNET_20 = "v2.0.50727" const DOTNET_30 = "v3.0" const DOTNET_35 = "v3.5" dim objFrameworkVers set objFrameworkVers = CreateObject("Scripting.Dictionary") wscript.echo "Found " & getFrameWorkVersions(objFrameworkVers) & " .NET Frameworks installed." if HasDotNet(DOTNET_20) then wscript.echo "Has .Net Framework 2.0 installed" end if function HasDotNet(ver) if objFrameworkVers.exists(ver) then HasDotNet = True else HasDotNet = False end if end function function getFrameWorkVersions(byref objDict) dim fso, winfolder, strPath, basefolder, f Set fso = CreateObject("Scripting.FileSystemObject") set winfolder = fso.GetSpecialFolder(WindowsFolder) strPath = winfolder.path & "\Microsoft.NET\Framework" set basefolder = fso.getfolder(strPath) objDict.removeAll for each f in basefolder.subfolders objDict.add f.name, f.name next getFrameWorkVersions = objDict.count end function