Convert VBScript to Batch File

Hi there,

I need to convert the following script that I think is VBScript, to a Batch File.

Thanks for your help,
Rene

SOURCE: http://codesnippts.blogspot.ca/2010/07/public-sub-softwareinformationvbsbyval.html

Public Sub SoftwareInformationVBS(ByVal strComputer As String, ByVal strUserName As String, ByVal strPwd As String)   
  
        Dim objWMIService, objFSO, objTextFile, colSoftware, objSoftware, objSWbemLocator   
  
        Try  
  
            objFSO = CreateObject("Scripting.FileSystemObject")   
            objTextFile = objFSO.CreateTextFile("c:\software.txt", True)   
  
            objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")   
  
            If (strComputer = Environment.MachineName.ToString) Then  
  
                objWMIService = objSWbemLocator.ConnectServer(strComputer, "root\cimv2")   
            Else  
                objWMIService = objSWbemLocator.ConnectServer(strComputer, "root\cimv2", strUserName, strPwd)   
            End If  
  
            objWMIService.Security_.ImpersonationLevel = 3   
  
            colSoftware = objWMIService.ExecQuery("Select * from Win32_Product")   
            objTextFile.WriteLine("Caption" & vbTab & _   
                "Description" & vbTab & "Identifying Number" & vbTab & _   
                "Install Date" & vbTab & "Install Location" & vbTab & _   
                "Install State" & vbTab & "Name" & vbTab & _   
                "Package Cache" & vbTab & "SKU Number" & vbTab & "Vendor" & vbTab _   
                    & "Version")   
            For Each objSoftware In colSoftware   
                objTextFile.WriteLine(objSoftware.Caption & vbTab & _   
                objSoftware.Description & vbTab & _   
                objSoftware.IdentifyingNumber & vbTab & _   
                objSoftware.InstallDate2 & vbTab & _   
                objSoftware.InstallLocation & vbTab & _   
                objSoftware.InstallState & vbTab & _   
                objSoftware.Name & vbTab & _   
                objSoftware.PackageCache & vbTab & _   
                objSoftware.SKUNumber & vbTab & _   
                objSoftware.Vendor & vbTab & _   
                objSoftware.Version)   
            Next  
            objTextFile.Close()   
  
        Catch ex As Exception   
  
        End Try  
           
End Sub  

Open in new window

LVL 10
ReneGeAsked:
Who is Participating?
 
Bill PrewCommented:
How about this?
wmic product get Caption,Description,IdentifyingNumber,InstallDate2,InstallLocation,InstallState,Name,PackageCache,SKUNumber,Vendor,Version /format:csv >c:\software.txt

Open in new window

~bp
0
 
ReneGeAuthor Commented:
And why didn't I think of this one??
Thanks Bill!!
0
 
Bill PrewCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.