Solved

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

Posted on 2011-02-11
9
759 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 33

Expert Comment

by:Todd Gerbert
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:cschene
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

OfficeMate Freezes on login or does not load after login credentials are input.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now