Solved

In windows 7 how do I programmatically detect if .net is anabled?

Posted on 2011-02-11
9
762 Views
Last Modified: 2012-05-11
How do I programmatically detect in .vbs whether .net is is abled.

For an extra 250 points, how do I enable it if it is not already enabled?
0
Comment
Question by:cschene
  • 4
  • 4
9 Comments
 
LVL 3

Expert Comment

by:dn0rm
ID: 34873919
this MS knowledge base article should point you in the right direction i believe...

http://msdn.microsoft.com/en-us/kb/kbarticle.aspx?id=318785

i don't know that you need to actually enable a .net framework unless you are talking about installing a web application - as you do need to enable it in IIS.

to install 2.0 on top of IIS (this happens if IIS is installed after .net framework, you can execute this command from the command line:

C:\Windows\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis.exe -i




0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 34874144
I'm pretty sure Windows 7 ships with at least .Net 3.5 pre-installed, you probably don't need check (unless you're looking for .Net 4 specifically).
0
 

Author Comment

by:cschene
ID: 34898642
It seems part of my problem is that since I am running a 32 program (my 2008 installshield installer) I am reading values from HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node and writing to there was well. So when I try to read the registry key, I am unable to see it.

So, how do I access the "real (64 bit registry)" from a 32 bit app.

thanks,

chris
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 34899659
What is it, exactly, you're trying to accomplish - what is your ultimate end goal?  Your question was originally concerning detecting the presence of .Net Frameworks specifically under Windows 7 using VBScript, and now we appear to be moving to programming - I would prefer to skip complex intermediate steps before we finally come to what your question really is. ;)

But judging by your question, I am guessing that you are attempting to create a custom action for an installer to detect if the right .Net Framework for your application is installed (and this really is a bit of guess, which is why more info would be useful).

1. All Windows 7 installations already include .Net 3.5.

2. When .Net is installed on a 64-bit system it includes both 32- and 64-bit components, which means you can still follow the instructions dn0rm posted a link to, reading from HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node (which is just the 32-bit version of the registry).

3. I'm not familiar with InstallShield, but I would imagine there's a checkbox somewhere you can just click that says ".Net 3.5 or better is required for this application" and be done with it.

4. If you're programming in a .Net language, and you're at v4, you can use RegistryKey.OpenBaseKey() (http://msdn.microsoft.com/en-us/library/microsoft.win32.registrykey.openbasekey.aspx) to get the 64-bit registry from a 32-bit application - otherwise you need to use the RegOpenKeyEx() API (http://msdn.microsoft.com/en-us/library/ms724897(VS.85).aspx).  You're probably out of luck if you're stuck in VBScript.
0
 

Author Comment

by:cschene
ID: 34899935
My ultimate goal is

1) to determine from my VBScript if .net 2.0 Sp1 or .net 2.0 SP2 is installed
2) If it is not installed, to install it

Now that I am working more with this, i do see that every Win7 or 2008 OS I have worked with so far has had .net installed (I did not know this at first), so my question may be unnecessary.

I do have another reason to access the registry and would like to read and write......I considred writing a VB.net app and running that from VBscript.
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 34900272
every Win7 or 2008 OS I have worked with so far has had .net installed (I did not know this at first)
http:#a34874144 ;)

Still, that should probably be a task that's handled by the InstallShield Installer anyway.  Like I said, I'm not familiar with InstallShield, but I know the Visual Studio Installer tool has an option to check for, and install if necessary, a specific .Net version.

Writing a .Net application to read/write the registry and launching it from VBScript would probably work out okay, however I could reconsider whether using the registry is necessary at all, and if so is it really necessary to get the 64-bit keys from a 32-bit application?

Will your application run as 64-bit?
0
 

Author Comment

by:cschene
ID: 34934368
Ok, I found an option in install shield......to disable or enable registry reflection (comments from the help page attached)....problem is when I go there, no such option for registry reflection is shown.

Here is the help infomration:

TASK

To enable or disable registry reflection for all new and existing registry keys that are affected by a component:

1.In the View List, under Organization, click Components.
1.In the Components explorer, select the component for which you want to configure the registry reflection setting.
1.To enable registry reflection, set the Disable Registry Reflection setting to No. This is the default value.
To disable registry reflection, set the Disable Registry Reflection setting to Yes.


--------------------------------------------------------------------------------

Enabling and Disabling Registry Reflection 
InstallShield 2008 

Registry reflection keeps the 32-bit registry view and the 64-bit registry view in sync on the target machine. 

 
Note

Only 64-bit systems with Windows Installer 4.0 support registry reflection. Other systems ignore the registry reflection setting. 

If an end user installs a 64-bit application that has a component with registry reflection enabled, Windows Installer makes the associated registry changes in the 64-bit view of the registry, and the reflector copies the registry changes to the 32-bit registry view. Similarly, if an end user then installs a 32-bit application that modifies the same registry key or value, Windows Installer makes the associated registry changes in the 32-bit view of the registry, and the reflector copies the registry changes to the 64-bit registry view. 

If registry reflection is disabled, Windows Installer calls the RegDisableReflectionKey function on each key being accessed by the component. This function disables registry reflection for the specified key. Disabling reflection for a key does not affect reflection of any subkeys. 

 
Task

To enable or disable registry reflection for all new and existing registry keys that are affected by a component: 

In the View List under Organization, click Components.
In the Components explorer, select the component for which you want to configure the registry reflection setting.
To enable registry reflection, set the Disable Registry Reflection setting to No. This is the default value.
To disable registry reflection, set the Disable Registry Reflection setting to Yes. 

For more information about registry reflection, see Registry Reflection in the MSDN Library. 


--------------------------------------------------------------------------------
InstallShield Help Library
23 May 2007
 Copyright Information | Contact Macrovision
 
 
   
  Popup

Open in new window

0
 

Author Comment

by:cschene
ID: 34934386
I can get a snap shot of the Installshield options if you would like to see them
0
 
LVL 33

Accepted Solution

by:
Todd Gerbert earned 250 total points
ID: 34937410
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Batch file or script with password 22 43
PerfMon Report Time Out 6 23
location of a form 2 12
SQL Query Help Top 1 and Distinct? 6 22
You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question