Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

Scan the network for a software

Hi,

I need to find who all have MSN messenger installed in there machine.can we find only 1 particular software.I have softwares which will take the whole machine inventory.But i need to search for a particular software on all machines in the domain/Network.

THX
Sharath
Avatar of sirbounty
sirbounty
Flag of United States of America image

Const HKLM = &H80000002
Dim objFSO:Set objFSO=CreateObject("Scripting.FileSystemObject")
Dim objOutput:Set objOutput=objFSO.CreateTextFile("C:\MSNMsgInstallations.txt")
strFile="C:\Computers.txt"
arrData=Split(objFSO.OpenTextFile(strFile).ReadAll, vbNewLine)

For Each PC in arrData
  Set objRegistry = GetObject ("winmgmts:\\" & PC & "\root\default:StdRegProv")
  strKeyPath = "Software\Microsoft\MSNMessenger"
  strValueName = "InstallationDirectory"
  objRegistry.GetStringValue HKLM, strKeyPath, strValueName, strData
  If IsNull(strData) Then
       objOutput.WriteLine "MSN is not installed on " & PC
  Else
       objOutput.WriteLine "MSN is installed on " & PC " & " in " & strData
  End If
  Set objRegistry=Nothing
Next
objOutput.Close
wscript.echo "Process completed."
Set objOutput=Nothing
Set objFSO=Nothing
Avatar of bsharath

ASKER

I get this

---------------------------
Windows Script Host
---------------------------
Script:      C:\Software scan.vbs
Line:      15
Char:      56
Error:      Expected end of statement
Code:      800A0401
Source:       Microsoft VBScript compilation error

---------------------------
OK  
---------------------------


I have created a file called computers.txt and a machine name in it.
My mistake...

Const HKLM = &H80000002
Dim objFSO:Set objFSO=CreateObject("Scripting.FileSystemObject")
Dim objOutput:Set objOutput=objFSO.CreateTextFile("C:\MSNMsgInstallations.txt")
strFile="C:\Computers.txt"
arrData=Split(objFSO.OpenTextFile(strFile).ReadAll, vbNewLine)

For Each PC in arrData
  Set objRegistry = GetObject ("winmgmts:\\" & PC & "\root\default:StdRegProv")
  strKeyPath = "Software\Microsoft\MSNMessenger"
  strValueName = "InstallationDirectory"
  objRegistry.GetStringValue HKLM, strKeyPath, strValueName, strData
  If IsNull(strData) Then
       objOutput.WriteLine "MSN is not installed on " & PC
  Else
       objOutput.WriteLine "MSN is installed on " & PC & " in " & strData
  End If
  Set objRegistry=Nothing
Next
objOutput.Close
wscript.echo "Process completed."
Set objOutput=Nothing
Set objFSO=Nothing
It says not found.

Can you give me the same thing for yahoo
What are the changes we need to make for different softwares.
Const HKLM = &H80000002
Dim objFSO:Set objFSO=CreateObject("Scripting.FileSystemObject")
Dim objOutput:Set objOutput=objFSO.CreateTextFile("C:\MSNMsgInstallations.txt")
strFile="C:\Computers.txt"
arrData=Split(objFSO.OpenTextFile(strFile).ReadAll, vbNewLine)

For Each PC in arrData
  Set objRegistry = GetObject ("winmgmts:\\" & PC & "\root\default:StdRegProv")
  strKeyPath = "Software\Yahoo\Essentials"
  strValueName = "MainDir"
  objRegistry.GetStringValue HKLM, strKeyPath, strValueName, strData
  If IsNull(strData) Then
       objOutput.WriteLine "MSN is not installed on " & PC
  Else
       objOutput.WriteLine "MSN is installed on " & PC & " in " & strData
  End If
  Set objRegistry=Nothing
Next
objOutput.Close
wscript.echo "Process completed."
Set objOutput=Nothing
Set objFSO=Nothing
Admin Edit
It says

---------------------------
Windows Script Host
---------------------------
Script:      C:\Software scan.vbs
Line:      23
Char:      1
Error:      Type mismatch: 'Admin'
Code:      800A000D
Source:       Microsoft VBScript runtime error

---------------------------
OK  
---------------------------
My mistake...use this:

Const HKLM = &H80000002
Dim objFSO:Set objFSO=CreateObject("Scripting.FileSystemObject")
Dim objOutput:Set objOutput=objFSO.CreateTextFile("C:\MSNMsgInstallations.txt")
strFile="C:\Computers.txt"
arrData=Split(objFSO.OpenTextFile(strFile).ReadAll, vbNewLine)

For Each PC in arrData
  Set objRegistry = GetObject ("winmgmts:\\" & PC & "\root\default:StdRegProv")
  strKeyPath = "Software\Yahoo\Essentials"
  strValueName = "MainDir"
  objRegistry.GetStringValue HKLM, strKeyPath, strValueName, strData
  If IsNull(strData) Then
       objOutput.WriteLine "YIM is not installed on " & PC
  Else
       objOutput.WriteLine "YIM is installed on " & PC & " in " & strData
  End If
  Set objRegistry=Nothing
Next
objOutput.Close
wscript.echo "Process completed."
Set objOutput=Nothing
Set objFSO=Nothing

As for what to test, you'll need to know the reg path - I just happen to have those two installed, so it was easy to locate...
Mainly this is the path to the data:
  strKeyPath = "Software\Yahoo\Essentials"
and this is the value you're looking for...could be different for different products...
  strValueName = "MainDir"
I have yahoo installed in my computer but it says not found.For msn this worked.
Hmm - could be that it's a different version.
What does this return?

Click Start->Run->Cmd /c reg query hklm\software\yahoo > c:\yahoo.txt && start c:\yahoo.txt

HKEY_LOCAL_MACHINE\software\yahoo\pager
HKEY_LOCAL_MACHINE\software\yahoo\Skin
ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks...
Very glad to help you - as always! :^)