473,797 Members | 3,144 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to querry network for machines running the .NET runtime?

I am trying to find out what percentage of machines on my network have the
..NET runtime installed. What would be the best reccomendation for this
(other than SMS)?

Is using WSH & WMI an answer? Can anyone point me in te right direction?
Jul 21 '05 #1
1 1573
I came up with a solution. Whether or not it's the best one, I don't know,
but it works.

Steps:

1) Export list of computer names from a container or query in Active
Directory Users and Computers.

2) Run script

'copy and paste this into the command window and hit enter

'be sure to change the paths if necessary

cscript "<ScriptPath>\< ScriptName>.vbs " "<FilePath> " "<HostFileName> "
"<LogFileNa me>" 1

3) View Log

The script:

############### ############### #########

Dim strLogMessage

Dim strIpFile

Dim strLogFile

Dim strPath

Dim intExtendedLog

strLogMessage=" "

strIpFile=""

strLogFile=""

strPath=""

intExtendedLog= 0

On Error Resume Next

' Check Script Engine

If right(ucase(wsc ript.FullName), 11)="WSCRIPT.EX E" Then

strLogMessage = strLogMessage & LogMessage( "ERROR: You must run this
script using cscript, for example 'cscript " & wscript.scriptn ame & "'.", 1,
1 )

wscript.quit 0

End If

' Check USAGE

If wscript.argumen ts.count <> 4 Then

strLogMessage = strLogMessage & LogMessage( "Usage: cscript " &
wscript.scriptn ame & " <Path> <IpFile.txt> <LogFile> <ExtendedLog> " & vbCrLf
& vbCrLf & _

" <Path> must be a full path of a folder that contains all of these
files:" & vbCrLf & _

" " & strIpFile & vbCrLf & _

" " & strLogFile & vbCrLf , 1, 1 )

wscript.quit

End If

' Set Command Switch Variables

strPath = wscript.argumen ts(0)

strIpFile = wscript.argumen ts(1)

strLogFile = wscript.argumen ts(2)

intExtendedLog = wscript.argumen ts(3)

If intExtendedLog< >"0" Then

intExtendedLog= 1

Else

intExtendedLog= 0

End If

' Verify that ipfile is accessible.

Set onet = createobject("w script.network" )

Set ofs = createobject("s cripting.filesy stemobject")

Set oipFile = ofs.opentextfil e(strIpFile, 1, false)

If (Err.Number <> 0) Then

strLogMessage = strLogMessage & LogMessage( "Cannot open " & strIpFile,
1, 1 )

wscript.quit

End If

' Make sure to end with a \ character.

If Right(strPath, 1) <> "\" Then

strPath = strPath & "\"

End If

Set osvcLocal = getobject("winm gmts:root\cimv2 ")

'The error-handling code is below the function that may throw one - execute
it.

On Error Resume Next

While Not oipFile.atEndOf Stream

ip = oipFile.ReadLin e()

ip = Trim( ip )

strLogMessage = strLogMessage & LogMessage( "Connecting to " & ip &
"...", 0, intExtendedLog )

Err.Clear

Set osvcRemote =
GetObject("winm gmts:{impersona tionLevel=imper sonate}\\" & ip &
"\root\cimv 2")

If (Err.Number <> 0) Then

strLogMessage = strLogMessage & LogMessage( "Failed to connect to
" & ip & ".", 1, intExtendedLog )

Else

'exeCorrectPatc h = detectOSVersion ( osvcRemote )

'if (exeCorrectPatc h <> "") then

' Lay the bits on the remote computer.

strLogMessage = strLogMessage & LogMessage( "Checking for
..NET Runtime " & exeCorrectPatch & "...", 0, intExtendedLog )

strLogMessage = strLogMessage &
LogMessage( ip & vbtab & FindTheRuntime( osvcRemote, ip ), 1,
intExtendedLog )

strLogMessage = strLogMessage &
LogMessage( "Check Complete.", 0, intExtendedLog )

'End If

End If ' Do the next IP address, then the next IP address...

'short delay

wscript.Sleep 500 ' Sleep one half second.

Wend

oipFile.close()

Set oipFile = Nothing

strLogMessage = strLogMessage & LogMessage( "Script complete. Exiting.", 0,
intExtendedLog )

'commit the log info to a file

Set logFile = CreateObject("s cripting.filesy stemobject")

Set oFileStream = logFile.CreateT extFile( strPath & strLogFile, True )

oFileStream.Wri te( strLogMessage )

oFileStream.Clo se()

Set oFileStream = Nothing

Set logFile = Nothing

Function FindTheRuntime( osvcRemote, ip )

strRuntime="Mic rosoft .NET Framework"

bFound=False

For Each Process In osvcRemote.Inst ancesOf("Win32_ product")

If InStr( 1, Process.Name, strRuntime, 1 )>0 Then

bFound=True

Exit For

End If

Next

FindTheRuntime = bFound

End Function

Function detectOSVersion ( osvcRemote )

Dim systemType

systemType="do it"

set oOSInfo = osvcRemote.Inst ancesOf("Win32_ OperatingSystem ")

'Only one instance is ever returned (the currently active OS), even
though the following is a foreach.

For Each objOperatingSys tem In oOSInfo

If (objOperatingSy stem.OSType <> 18) Then

' Make sure that this computer is Windows NT-based.

strLogMessage = strLogMessage & LogMessage( ip & " is not a
Windows XP, Windows 2000, or Windows 2003 Server computer.", 0,
intExtendedLog )

Else

systemType = objOperatingSys tem.Version

End If

Next

detectOSPatch = systemType

End Function

Function LogMessage( theMessage, isMandatoryMess age, useExtendedLog )

If isMandatoryMess age=1 OR useExtendedLog= 1 Then

wscript.echo theMessage

LogMessage = vbcrlf & theMessage

Else

wscript.echo theMessage

LogMessage = ""

End If

End Function

############### ############### #########


"Mike S" <ms***@pac.oded odea.edu> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
I am trying to find out what percentage of machines on my network have the
.NET runtime installed. What would be the best reccomendation for this
(other than SMS)?

Is using WSH & WMI an answer? Can anyone point me in te right direction?

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1510
by: Chucker | last post by:
Hi Folks, I got an Auto-Updating Application that is supposed to download all the assemblies needed from a deployment machine when started. Here ist the Code for the Launcher that has to be deployed to the Machine actually running the Code. All other Stuff should be downloaded upon execution time. using System;
4
2701
by: Matt Dockerty | last post by:
Hi, I'm trying to connect to a network share using a username / password / domain of my choosing. I've tried the WindowsIdentity.Impersonate route but can only impersonate the users on the local machine / domain using this method. I could go about creating actual mapped drives but I'd much rather connect temporarily to a UNC share without affecting the system configuration.
10
4118
by: Woody Splawn | last post by:
I have been developing a ClientServer application on one machine at my office but the time has come to transfer it to the customer. The customer is running a Windows 2000 local area network. I will keep a copy of the applicaiton and all it's code on one of the client machines connected to the local area network at the customers. This machine has a full blown copy of Visual Studio 2003. SQL Server 2000 is the back-end, both at my office...
1
234
by: Mike S | last post by:
I am trying to find out what percentage of machines on my network have the ..NET runtime installed. What would be the best reccomendation for this (other than SMS)? Is using WSH & WMI an answer? Can anyone point me in te right direction?
3
1244
by: cj | last post by:
I have a program (soap client that also uses sql server stored procs) that I built and tested on my c: and it works great. It was decided it should be put on the network drive. I copied obj\release\*.* to a folder on the network and the program hung trying to connect with the soap server. I tested on my machine and it works. I copied the whole project directory to the network and intended to run it in debug mode from the network but...
2
1605
BradHodge
by: BradHodge | last post by:
Reading a post regarding network security on a linked database, I saw this post by PDog on number of users in a network Environment... I am about to put a very small database (2200 kb back-end) out on the network. I am expecting 75-100 users in the system at any one time. The database is largely Read-Only (with the exception a few record changes made daily). I have had it in use by ~20 users continuously for the last 6 months, and have...
1
9640
by: ekynox | last post by:
Hi guys, have been playing with WMI to add a network printer connection to a Windows XP pc. My environment consists of a server running Windows Server 2003 and Visual Studio 2005 and a test pc running windows xp. Further, I have setup a full domain controller environment. I have managed to write the code to add the network printer and it works fine when installing the printer on the same machine the code is executing from i.e the server or...
1
2452
by: 2boysnus | last post by:
I set up a network at my work last week and we have been having some problems that I have not ben able to fix. We have: 2 New computers running Windows XP 2 New Computers running Windows Vista Home Premium and 2 old Computers that are both running Windows XP and were the only two computers before and were networked. We replaced an old router to a larger router with VPN capabilities. Everything went fine for the setup with the normal...
1
5231
by: Bhrionn | last post by:
Hello World, I am working on implementing a build for my companies application. The scenario implemeted is producing the error: ‘Class does not support automation or does not support expected interface' when I try to run the RegFree COM interop application from a clients machine. The application works fine for all development machines when run locally or from the network. The application is run from the network so - the component is not...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9537
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10246
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10023
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7560
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5459
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3750
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.