matthew phung
asked on
how to check .net version installed on 500 workstations
I work for a company with a lot of workstations and we currently use IBM BigFix to query worksations for their .Net framework version. My question is Is there another way to query workstations besides using BigFix or Tanium? All I want to do is check each workstation for .Net 4.0 and above and report all the names of the workstations that does not have .Net 4.0 or above.
What OS are the workstations? Windows 7 or higher?
Its certainly possible, don't have any code on hand to do it though. I can think of two ways immediately that you could achieve this. The first is a bit crude (actually, a lot!) , but has the benefit of being easy to understand and very short indeed :)
Both answers rely on the fact that the registry key HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\NET Framework Setup\NDP has one subkey per installed framework - so reading that on each machine in turn would give you the info you need. Further, all dotnet frameworks from 4.0 onwards use a registry key of "v4" - so checking for HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\NET Framework Setup\NDP\v4 would tell you have 4.0 *or better* without investigating further, which is probably good enough
Now, on to the crude method :)
Assuming you have your users logging into a domain, you can establish a network share on a server that is world writable, and have each user login script execute the relatively simple command:
RegEdit /a %COMPUTERNAME%.reg "HKEY_LOCAL_MACHINE\SOFTWA RE\Microso ft\NET Framework Setup\NDP"
(placing the share path in front of the computername variable so that it writes to the network)
as %COMPUTERNAME% contains the name of the computer (logically enough) that should give you a separate file for each workstation, containing the registry keys under the key indicated. Simply wait a few days, then you should have the info you need (although not really in a tidy list without further processing)
For a less crude method - there is a powershell module (formerly on the ms site, now on codeplex) that lets you query the registry of a remote machine. You could logically write a powershell script to check the registry key above for a single named remote machine (passed as an argument) then you need to call that script once per machine, and record the result.
With 500 workstations though, iterating though the set (particularly if you aren't going to know what IP they might have or if they are turned on at any given moment) could be interesting. You can also use WMI (although its more awkward to code for than a dedicated PS module) - both methods would have the benefit of outputting a tidy list. Combining this with the first method, you could run (say) vbscript in the login script, extract the info you need locally, then write it to a database or similar on a server - but that's a fair bit of work to code up (of course, if you wanted to re-use the technique for other checks, then it might be worth investing time coding a solution so that you have an example to modify when you have something you want and can't get easily by any other method)
Both answers rely on the fact that the registry key HKEY_LOCAL_MACHINE\SOFTWAR
Now, on to the crude method :)
Assuming you have your users logging into a domain, you can establish a network share on a server that is world writable, and have each user login script execute the relatively simple command:
RegEdit /a %COMPUTERNAME%.reg "HKEY_LOCAL_MACHINE\SOFTWA
(placing the share path in front of the computername variable so that it writes to the network)
as %COMPUTERNAME% contains the name of the computer (logically enough) that should give you a separate file for each workstation, containing the registry keys under the key indicated. Simply wait a few days, then you should have the info you need (although not really in a tidy list without further processing)
For a less crude method - there is a powershell module (formerly on the ms site, now on codeplex) that lets you query the registry of a remote machine. You could logically write a powershell script to check the registry key above for a single named remote machine (passed as an argument) then you need to call that script once per machine, and record the result.
With 500 workstations though, iterating though the set (particularly if you aren't going to know what IP they might have or if they are turned on at any given moment) could be interesting. You can also use WMI (although its more awkward to code for than a dedicated PS module) - both methods would have the benefit of outputting a tidy list. Combining this with the first method, you could run (say) vbscript in the login script, extract the info you need locally, then write it to a database or similar on a server - but that's a fair bit of work to code up (of course, if you wanted to re-use the technique for other checks, then it might be worth investing time coding a solution so that you have an example to modify when you have something you want and can't get easily by any other method)
This can be easily achieved with powershell. If the workstations are Windows 7 or higher.
ASKER
Thank you Dave for your detailed answer. I am not too familiar with PowerShell so is there a good tutorial/resource you guys recommend. I am very strong in C# and VB.Net. I appreciate your help, guys
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Are you able to run a DOS command remotely on all the 500 workstations ?
It could search for the .net string to detect if the .NET is installed or not.
Would that be sufficient ? If Yes i can provide the command i have somewhere.
It could search for the .net string to detect if the .NET is installed or not.
Would that be sufficient ? If Yes i can provide the command i have somewhere.
ASKER
Wiley, Thank you for the detailed reply again. I will definitely play around with the code.
Stampel, I might be able to run DOS remotely so can you provide me the command? Once again, thank you everyone for your help
Stampel, I might be able to run DOS remotely so can you provide me the command? Once again, thank you everyone for your help
Some of this may already be covered before, but Microsoft has a good MSDN article that helps summarize how to do this: http://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx
In BigFix, you should be able to create a simple fixlet to search for the reg key and values you need -- e.g., HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\NET Framework Setup\NDP (from article above). Fixlets are much easier than writing custom scripts in my opinion. You may as well use BF if you already have it, to keep it simple.
IBM has lots of sample solutions to help with this, for instance this example to search for a value in a reg key:
https://www.ibm.com/developerworks/community/forums/html/topic?id=d64a6ad3-2664-4cc2-8389-c534668bf033
Hope this helps.
In BigFix, you should be able to create a simple fixlet to search for the reg key and values you need -- e.g., HKEY_LOCAL_MACHINE\SOFTWAR
IBM has lots of sample solutions to help with this, for instance this example to search for a value in a reg key:
https://www.ibm.com/developerworks/community/forums/html/topic?id=d64a6ad3-2664-4cc2-8389-c534668bf033
Hope this helps.
Ok here is the command to return any installed software matching ".NET"
C:\>wmic product get name | findstr .NET
result for me =>
Microsoft .NET Framework 4.5.1 (EN)
Microsoft .NET Framework 4.5.1
C:\>wmic product get name | findstr .NET
result for me =>
Microsoft .NET Framework 4.5.1 (EN)
Microsoft .NET Framework 4.5.1