[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

want to scan my network to find all machines which has office 2007 installed

Posted on 2007-08-01
24
Medium Priority
?
355 Views
Last Modified: 2010-03-05
Hi,

I want to scan my network to find all machines which has office 2007 installed.This is very urgent and need some tested solutions please

regards
Sharath
0
Comment
Question by:bsharath
  • 12
  • 11
24 Comments
 
LVL 9

Expert Comment

by:nightmare2
ID: 19608286
Use Microsoft Software Inventory Analyzer: http://www.microsoft.com/resources/sam/msia.mspx
0
 
LVL 12

Expert Comment

by:zoofan
ID: 19608386
Never tried that, will have to check it out.  As windows does not store the Version of Office Suite as a value that Im aware of, I can retrieve the versions of word and excel as I think thats what your really after anyway.  This script will prompt for a file containing a list of pc's to check and save the output into a csv comma delimited file with computer name, word version, excel version, errors if any and notify you when its complete with the file name it saved as.

'===Start copy: getappversions.vbs===
' ---------------------------------------------------------------'
' getappversions.vbs
' 'Sample VBScript to query remote computers
' 'and return versions for word and excel.
' ''Author Riley C. aka ZooFan
' '''Version 2.3 - July 2007
' ''''www.experts-exchange.com question ID: 22734176
' ---------------------------------------------------------------'
'
Option Explicit
Const ForReading = 1, ForWriting = 2, ForAppending = 3 'FileObject Access Type
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 'FileObject Format Type
Dim objFso
Dim objWshshell
Dim objOutputFile
Dim strCurPath
Dim dte
Dim tme
Dim arrPCnames()
Dim intPCLoop      
Dim strNewFile
Dim strPCFile
Dim strReturn
      Set objFso = CreateObject("Scripting.FileSystemObject")
      Set objWshShell = WScript.CreateObject("WScript.Shell")
      strCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
      dte = Replace(FormatDateTime(date(),vbshortdate),"/","-")
      tme = Replace(Replace(FormatDateTime(now(),vbLongtime),":","-")," ","")
      strNewFile = strCurPath & "\" & tme & "_" & dte & ".csv"
      strPCFile = InputBox("Please enter the full path and file" & VbCrLf & "name of the file with the computer names.","Get application versions from remote computers..")
            If Not objFso.FileExists(strPCFile) Then
                  MsgBox "You must enter a valid full path and file name!",vbOKOnly,"Get application versions from remote computers.."
                WScript.Quit(0)
            Elseif strPCFile = "" Then
                  MsgBox "You must enter a filename!",vbOKOnly,"Get application versions from remote computers.."
                WScript.Quit(0)
            Else
            Call createoutputfile(strNewFile)
            Call readpclist(strPCFile)
                                          Set objOutputFile = objFso.OpenTextFile(strNewFile,ForWriting,TristateUseDefault)
                                          objOutputFile.WriteLine("Computer,Word,Excel,Errors")
                                                For intPCLoop = LBound(arrPCnames) To UBound(arrPCnames)
                                                      strReturn = getappver(arrPCnames(intPCLoop))
                                                                  objOutputFile.WriteLine(strReturn)
                                                Next
                                           objOutputFile.Close      
                  MsgBox "File has been processed, and results saved in " & strNewFile ,vbOKOnly,"Get application versions from remote computers."      
            End If
      WScript.Quit(0)                                    
Sub readpclist(strPcList)
Dim objPCnames
Dim objReadFile
Dim intLneCount
      Set objPCnames = objFso.GetFile(strPCFile)
      Set objReadFile = objPCnames.OpenAsTextStream(ForReading, TristateUseDefault)
            Do Until objReadFile.AtEndOfStream
                  ReDim Preserve arrPCnames(intLneCount)
                  arrPCnames(intLneCount) = objReadFile.ReadLine
                  intLneCount = intLneCount + 1
            Loop
      objReadFile.Close
End sub                                    
Sub createoutputfile(strNewFileName)
            If objFso.FileExists(strNewFileName) Then
                  objFso.deleteFile(strNewFileName)
            Else
                  Set objOutputFile = objFso.CreateTextFile(strNewFileName)
                  objOutputFile.Close      
            End If
End Sub
Function getappver(strcomputer)
Dim objExcel
Dim objWord
Dim objFso
Dim iErr
Dim iErr2
Dim testConn
Dim iErr1Desc
Dim iErr2Desc
On Error Resume Next            
            Set testConn = GetObject("winmgmts:\\" & strcomputer,"Root\CIMV2")
            iErr = Hex(Err.Number)
            Select Case Ucase(iErr)
                  Case "1AD"
                        Set objExcel = CreateObject("Excel.Application", strcomputer)
                              iErr2 = Hex(Err.Number)
                              Select Case Ucase(iErr2)
                              Case "1AD"      
                              Set objWord = CreateObject("Word.Application", strcomputer)
                                    getappver = strcomputer & "," & objWord.Version & "," & objExcel.Version
                                    objExcel.Quit
                                    objWord.Quit
                              Case Else
                              iErr2Desc = Err.Description
                                    getappver = strcomputer & ",Error,Error," & iErr2Desc
                              End Select
                  Case Else
                        iErr1Desc = Err.Description
                        getappver = "!" & strcomputer & ",Error,Error," & iErr1Desc
            End Select
End Function
'===End copy: getappversions.vbs===



any problems let me know.

zf
0
 
LVL 11

Author Comment

by:bsharath
ID: 19608478
thanks zoofan.

I get this.

What does 11 and 12 mean
Computer      Word      Excel      Errors
dev-chen-mrd100      12      12      
dev-chen-srv400      Error      Error      Permission denied
dev-chen-srv401      12      12      
indiasophos      12      12      
dev-chen-pc5001      12      12      
dev-chen-pc5000      12      12      
dev-chen-nb114      11      11      

If the machine is off not pinging.Can it display not pinging and instead of 11 and 12 can it change when it comes to reports
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 11

Author Comment

by:bsharath
ID: 19608483
nightmare2
This software scans but scans all excel file not only 2007
0
 
LVL 12

Expert Comment

by:zoofan
ID: 19608508
If the machine is Off you will get an error that it can not connect to it.
"The remote server machine does not exist or is unavailable"

And Im not really understanding what you want to change????

zf
0
 
LVL 12

Expert Comment

by:zoofan
ID: 19608516
Just because you cant ping it dosnt mean it off!  :-) firewall maybe?

zf
0
 
LVL 12

Expert Comment

by:zoofan
ID: 19608523
And 11 and 12 are the version numbers for Word or Excel

zf
0
 
LVL 11

Author Comment

by:bsharath
ID: 19608549
11 means 2003 and 12 means 2007 ?
We do not have any firewall.
What i wanted to change is.When we know 11 is 2003 and 12 is 2007.If possible in the results file can you change it as 2003 and 2007 instaed of 11 and 12.

0
 
LVL 11

Author Comment

by:bsharath
ID: 19608566
I get some 10's in the xls file.What does 10 mean
0
 
LVL 12

Expert Comment

by:zoofan
ID: 19608592
   * 1987 2.0 for Windows
    * 1990 3.0
    * 1992 4.0
    * 1993 5.0 (Office 4.2 & 4.3, also a 32-bit version for Windows NT only)
    * 1995 7 for Windows 95 - included in Office 95
    * 1997 97 - included in Office 97
    * 1999 2000 (9) included in Office 2000
    * 2001 2002 (10) included in Office XP
    * 2003 2003 (11) included in Office 2003
    * 2007 2007 (12) included in Office 2007


version history

zf
0
 
LVL 12

Expert Comment

by:zoofan
ID: 19608595
Would like it to convert the Version Number to the Office Suite it released with instead?

zf
0
 
LVL 11

Author Comment

by:bsharath
ID: 19608615
YEs you are corect.
0
 
LVL 12

Accepted Solution

by:
zoofan earned 2000 total points
ID: 19608641
Figured you would so I did.  This wil output the converted Office suite based on the application version number.

'===Start copy: getappversions.vbs===
' ---------------------------------------------------------------'
' getappversions.vbs
' 'Sample VBScript to query remote computers
' 'and return versions for word and excel.
' ''Author Riley C. aka ZooFan
' '''Version 2.4 - August 2007
' ''''www.experts-exchange.com question ID: 22734176
' ---------------------------------------------------------------'
'
Option Explicit
Const ForReading = 1, ForWriting = 2, ForAppending = 3 'FileObject Access Type
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 'FileObject Format Type
Dim objFso
Dim objWshshell
Dim objOutputFile
Dim strCurPath
Dim dte
Dim tme
Dim arrPCnames()
Dim intPCLoop      
Dim strNewFile
Dim strPCFile
Dim strReturn
      Set objFso = CreateObject("Scripting.FileSystemObject")
      Set objWshShell = WScript.CreateObject("WScript.Shell")
      strCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
      dte = Replace(FormatDateTime(date(),vbshortdate),"/","-")
      tme = Replace(Replace(FormatDateTime(now(),vbLongtime),":","-")," ","")
      strNewFile = strCurPath & "\" & tme & "_" & dte & ".csv"
      strPCFile = InputBox("Please enter the full path and file" & VbCrLf & "name of the file with the computer names.","Get application versions from remote computers..")
            If Not objFso.FileExists(strPCFile) Then
                  MsgBox "You must enter a valid full path and file name!",vbOKOnly,"Get application versions from remote computers.."
                WScript.Quit(0)
            Elseif strPCFile = "" Then
                  MsgBox "You must enter a filename!",vbOKOnly,"Get application versions from remote computers.."
                WScript.Quit(0)
            Else
            Call createoutputfile(strNewFile)
            Call readpclist(strPCFile)
                                          Set objOutputFile = objFso.OpenTextFile(strNewFile,ForWriting,TristateUseDefault)
                                          objOutputFile.WriteLine("Computer,Word,Excel,Errors")
                                                For intPCLoop = LBound(arrPCnames) To UBound(arrPCnames)
                                                      strReturn = getappver(arrPCnames(intPCLoop))
                                                                  objOutputFile.WriteLine(strReturn)
                                                Next
                                           objOutputFile.Close      
                  MsgBox "File has been processed, and results saved in " & strNewFile ,vbOKOnly,"Get application versions from remote computers."      
            End If
      WScript.Quit(0)                                    
Sub readpclist(strPcList)
Dim objPCnames
Dim objReadFile
Dim intLneCount
      Set objPCnames = objFso.GetFile(strPCFile)
      Set objReadFile = objPCnames.OpenAsTextStream(ForReading, TristateUseDefault)
            Do Until objReadFile.AtEndOfStream
                  ReDim Preserve arrPCnames(intLneCount)
                  arrPCnames(intLneCount) = objReadFile.ReadLine
                  intLneCount = intLneCount + 1
            Loop
      objReadFile.Close
End sub                                    
Sub createoutputfile(strNewFileName)
            If objFso.FileExists(strNewFileName) Then
                  objFso.deleteFile(strNewFileName)
            Else
                  Set objOutputFile = objFso.CreateTextFile(strNewFileName)
                  objOutputFile.Close      
            End If
End Sub
Function getappver(strcomputer)
Dim objExcel
Dim objWord
Dim objFso
Dim iErr
Dim iErr2
Dim testConn
Dim iErr1Desc
Dim iErr2Desc
On Error Resume Next            
            Set testConn = GetObject("winmgmts:\\" & strcomputer,"Root\CIMV2")
            iErr = Hex(Err.Number)
            Select Case Ucase(iErr)
                  Case "1AD"
                        Set objExcel = CreateObject("Excel.Application", strcomputer)
                              iErr2 = Hex(Err.Number)
                              Select Case Ucase(iErr2)
                              Case "1AD"      
                              Set objWord = CreateObject("Word.Application", strcomputer)
                                    getappver = strcomputer & "," & getSuiteName(objWord.Version) & "," & getSuiteName(objExcel.Version)
                                    objExcel.Quit
                                    objWord.Quit
                              Case Else
                              iErr2Desc = Err.Description
                                    getappver = strcomputer & ",Error,Error," & iErr2Desc
                              End Select
                  Case Else
                        iErr1Desc = Err.Description
                        getappver = "!" & strcomputer & ",Error,Error," & iErr1Desc
            End Select
End Function
Function getSuiteName(version)
      Select Case version
            Case 12
                  getSuiteName = "Office 2007"
            Case 11
                  getSuiteName = "Office 2003"
            Case 10
                  getSuiteName = "Office XP"
            Case 9
                  getSuiteName = "Office 2000"
            Case 8
                  getSuiteName = "Office 97"
            Case 7
                  getSuiteName = "Office 95"
            Case Else
                  getSuiteName = "Office 2-6"
      End Select
End function
'===End copy: getappversions.vbs===




zf
0
 
LVL 12

Expert Comment

by:zoofan
ID: 19608655
That what you were looking for?

zf
0
 
LVL 11

Author Comment

by:bsharath
ID: 19608697
Zoofan

For the help you have provided today is great.This cut down my job so much.
Thanks a lot again
0
 
LVL 12

Expert Comment

by:zoofan
ID: 19608702
My pleasure,  glad I could help.

zf
0
 
LVL 11

Author Comment

by:bsharath
ID: 19608739
I can raise a new post if you can add some more seaches in the same script.Is that possible
Need to find if Google talk,Hotmail Messenger,Yahoo messenger and some more messengers are installed in any machine in the network.
If you can work around the script is it possible.
0
 
LVL 12

Expert Comment

by:zoofan
ID: 19608779
Well,  not sure as I dont have a pc with any of them installed to test on or for that matter not sure the procedures can handle an app that isnt microsoft, so hold off for a bit and Ill test it out with other non-ms apps and if that works Ill load your apps on a test box to verify i can do it then let you know.

Any interest in changing the Terminal services scanning script to output to a csv file as well?  Is a much cleaner output I think.

zf
0
 
LVL 11

Author Comment

by:bsharath
ID: 19608807
Yes please
0
 
LVL 12

Expert Comment

by:zoofan
ID: 19608927
Post a question for the updated Terminal Services scan got it done.
0
 
LVL 11

Author Comment

by:bsharath
ID: 19609718
Zoofan
Terminal services scanning script
You mean find if it is a 120 day trial or licenced are u talking about this.
0
 
LVL 12

Expert Comment

by:zoofan
ID: 19609740
0
 
LVL 11

Author Comment

by:bsharath
ID: 19609801
0
 
LVL 11

Author Comment

by:bsharath
ID: 19609824
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

On a regular basis I get questions about slow RDP performance, RDP connection problems, strange errors and even BSOD, remote computers freezing or restarting after initiation of a remote session. In a lot of this cases the quick solutions made b…
Welcome to my series of short tips on migrations. Whilst based on Microsoft migrations the same principles can be applied to any type of migration. My first tip is around source server preparation. No migration is an easy migration, there is a…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Suggested Courses

834 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