[dba-Tech] Re: [AccessD] System Settings Etc

MartyConnelly martyconnelly at shaw.ca
Wed Dec 17 11:24:18 CST 2003


Here is another tool to monitor networks from basics using MS WMI and ADSI
that you can run from Access. WMI has to be installed below Win2000
This would take some time to learn and become familar with
but might get you info not available through various packages.

There are a lot of sample calls here
http://www.activxperts.com/activmonitor/windowsmanagement/wmisamples/

Two functions to list MS hotfixes and msi installed software on local or 
remote macines

Option Compare Database
Option Explicit
'needs reference set  to WMI extension library and WMI cntl library
'List all hotfixes on Computer Name
Function hotfix(Optional strComputerName = "Local") As String
Dim objWMIService As Object
Dim colItems As Object
Dim objItem As Object
Dim colQuickFixes As Object
Dim objQuickFix As Object
Dim strcomputer As String
Dim strMsg As String
' Check command line parameters
Select Case strComputerName
    Case "Local"
        ' Default if none specified is local computer (".")
        Set objWMIService = GetObject("winmgmts://./root/cimv2")
        Set colItems = objWMIService.ExecQuery("Select * from 
Win32_ComputerSystem", , 48)
        For Each objItem In colItems
            strcomputer = objItem.Name
        Next
    Case Else
        ' Command line parameter can either be a computer name
        ' or "/?" to request online help
        strcomputer = strComputerName
        If InStr(strcomputer, "?") > 0 Then Syntax
  
End Select

' Header line for screen output
strMsg = vbCrLf & "Hotfixes installed on " & strcomputer & ":" & vbCrLf 
& vbCrLf

' Enable error handling
On Error Resume Next

' Connect to specified computer
Set objWMIService = 
GetObject("winmgmts:{impersonationLevel=impersonate}!//" & strcomputer & 
"/root/cimv2")
' Display error number and description if applicable
If Err Then ShowError

' Query hotfixes
Set colQuickFixes = objWMIService.ExecQuery("Select * from 
Win32_QuickFixEngineering")
' Display error number and description if applicable
If Err Then ShowError

' Prepare display of results
For Each objQuickFix In colQuickFixes
    strMsg = strMsg _
           & "    Description:       " _
           & objQuickFix.Description & vbCrLf _
           & "    Hot Fix ID:        " _
           & objQuickFix.HotFixID _
           & "    Installation Date: " _
           & objQuickFix.InstallDate _
           & "    Installed By:      " _
           & objQuickFix.InstalledBy & vbCrLf & vbCrLf
Next

' Display results
strMsg = strMsg & vbCrLf & strMsg
hotfix = strMsg
Set objWMIService = Nothing
Set colItems = Nothing
Set objItem = Nothing
Set colQuickFixes = Nothing
Set objQuickFix = Nothing
'Done
End Function


Sub ShowError()
Dim strMsg As String
    strMsg = vbCrLf & "Error # " & Err.Number & vbCrLf & _
             Err.Description & vbCrLf & vbCrLf
     Debug.Print strMsg
     MsgBox strMsg
    Syntax
End Sub


Sub Syntax()
Dim strMsg As String

    strMsg = strMsg & vbCrLf _
           & "HotFixes.vbs,  Version 1.00" & vbCrLf _
           & "List installed hotfixes for any computer on the network" _
           & vbCrLf & vbCrLf _
           & "Usage:  CSCRIPT  //NOLOGO  HOTFIXES.VBS  [ computer_name ]" _
           & vbCrLf & vbCrLf _
           & "Where:  " & Chr(34) & "computer_name" & Chr(34) _
           & " is the optional name of a remote computer" & vbCrLf _
           & "                        (default is local computer name)" _
           & vbCrLf & vbCrLf _
           & "Based entirely on Microsoft TechNet Script " _
           & "Center's sample script:" & vbCrLf _
           & "http://www.microsoft.com/technet/treeview/default.asp?" _
           & "url=/technet/scriptcenter/compmgmt/ScrCM15.asp" _
           & vbCrLf & vbCrLf _
           & "Modified by Rob van der Woude" & vbCrLf _
           & "http://www.robvanderwoude.com"
    Debug.Print strMsg
    MsgBox strMsg
End Sub

'list all software installed via control panel or MSI, I forget which
'this may produce 1000 items on one machine
Function software() As String
Dim strcomputer As String
Dim objWMIService As Object
Dim colFeatures As Object
Dim objFeature As Object
Dim strMsg As String
Dim lFeatureCount As Long
strcomputer = "." 'set to local machine name
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strcomputer & "\root\cimv2")
Set colFeatures = objWMIService.ExecQuery _
             ("Select * from Win32_SoftwareFeature")
strMsg = ""
lFeatureCount = 0
For Each objFeature In colFeatures
lFeatureCount = lFeatureCount + 1
Debug.Print "Accesses: " & objFeature.Accesses
Debug.Print "Attributes: " & objFeature.Attributes
Debug.Print "Caption: " & objFeature.Caption
Debug.Print "Description: " & objFeature.Description
Debug.Print "Identifying Number: " & objFeature.IdentifyingNumber
Debug.Print "Install Date: " & objFeature.InstallDate
Debug.Print "Install State: " & objFeature.InstallState
Debug.Print "LastUse: " & objFeature.LastUse
Debug.Print "Name: " & objFeature.Name
Debug.Print "ProductName: " & objFeature.ProductName
Debug.Print "Vendor: " & objFeature.Vendor
Debug.Print "Version: " & objFeature.Version

strMsg = strMsg & vbCrLf & "Accesses: " & objFeature.Accesses
strMsg = strMsg & vbCrLf & "Attributes: " & objFeature.Attributes
strMsg = strMsg & vbCrLf & "Caption: " & objFeature.Caption
strMsg = strMsg & vbCrLf & "Description: " & objFeature.Description
strMsg = strMsg & vbCrLf & "Identifying Number: " & 
objFeature.IdentifyingNumber
strMsg = strMsg & vbCrLf & "Install Date: " & objFeature.InstallDate
strMsg = strMsg & vbCrLf & "Install State: " & objFeature.InstallState
strMsg = strMsg & vbCrLf & "LastUse: " & objFeature.LastUse
strMsg = strMsg & vbCrLf & "Name: " & objFeature.Name
strMsg = strMsg & vbCrLf & "ProductName: " & objFeature.ProductName
strMsg = strMsg & vbCrLf & "Vendor: " & objFeature.Vendor
strMsg = strMsg & vbCrLf & "Version: " & objFeature.Version

Next
software = strMsg
MsgBox "Software features=" & lFeatureCount
End Function


Erwin Craps - IT Helps wrote:

> He guys
>
>Sorry to come in.
>Now you are on the dba tech list I'm joining to.
>I'm trying to educate myself not to answer to wrongly posted/or grown
>into, threads.
>I got caught a few times :-)
>
>I just installed aida, looks very good.
>I wonder if you could tell me if this can be put into a server logon
>script that would inventorise the networked pc's each x weeks (or
>whatever) to put it's file somewhere on the server of my client, so I
>could collect it on a regulary base (with FTP or so) and keep a general
>database over here of all my clients networks?
>
>Just knowing if it can is sufficiant,just to save me some time finding
>out.
>
>Greetz
>Erwin
>
>
>
>-----Original Message-----
>From: dba-tech-bounces at databaseadvisors.com
>[mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of William
>Hindman
>Sent: Wednesday, December 17, 2003 3:11 PM
>To: Access Developers discussion and problem solving
>Cc: Discussion of Hardware and Software issues
>Subject: [dba-Tech] Re: [AccessD] System Settings Etc
>
>"(I wonder if we shouldn't continue over on dba-Tech :)" Bryan
>
>...lol ...once a moderator ...always a moderator :)
>
>...btw ...what do you find in Belarc that Aida won't turn up? ...I'm
>curious why you think you need both ...its not that I have anything
>against Belarc ...but I found Aida did more and its free to use on my
>client's systems as well ...just wondering if I need to look at Belarc
>again, eh?
>
>William Hindman
>There are no easy answers, but there are simple answers. We must have
>the courage to do what we know is morally right." --Ronald Reagan
>
>
>----- Original Message -----
>From: "Bryan Carbonnell" <carbonnb at sympatico.ca>
>To: "Access Developers discussion and problem solving"
><accessd at databaseadvisors.com>
>Sent: Wednesday, December 17, 2003 5:49 AM
>Subject: Re: [AccessD] System Settings Etc
>
>
>  
>
>>On 16 Dec 2003 at 16:53, William Hindman wrote:
>>
>>    
>>
>>>...hhhhmmm ...I've used both ...I prefer aida now but I never saw
>>>      
>>>
>any
>  
>
>>>problems with belarc ...are you by any chance using it on a Novell
>>>client?
>>>      
>>>
>>As much as you love bugging Gustav about Novell, I have run Belarc on
>>PCs with the Novell client on 'em with no noticable issues.
>>
>>P.S. Paul, I usually rely on more than 1 tools to get me the info I
>>need. I use both Belarc and Aida32.
>>
>>They both return different result sets.
>>
>>(I wonder if we shouldn't continue over on dba-Tech :)
>>
>>--
>>Bryan Carbonnell - carbonnb at sympatico.ca
>>Never argue with idiots. They drag you down to their level, then beat
>>you with experience.
>>
>>
>>_______________________________________________
>>AccessD mailing list
>>AccessD at databaseadvisors.com
>>http://databaseadvisors.com/mailman/listinfo/accessd
>>Website: http://www.databaseadvisors.com
>>
>>    
>>
>
>
>_______________________________________________
>dba-Tech mailing list
>dba-Tech at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-tech
>Website: http://www.databaseadvisors.com
>_______________________________________________
>dba-Tech mailing list
>dba-Tech at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-tech
>Website: http://www.databaseadvisors.com
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada





More information about the dba-Tech mailing list