How do I go about this?

PCandNetworking

New member
Local time
Yesterday, 21:21
Joined
Dec 17, 2002
Messages
5
Alright, I've got some Idea's but don't know what to do with them. :p

Anyways, this is what I got.

A form that has a LIST BOX with Computer Names.

A Sub Form that is linked to form by Computer Name.

When you click the Computer Name in the List Box, it changes the Sub Form to match.

Now, I have several nice scripts I'd like to implement to the DB that does a look up of various Computer Stuff. For Example: This script below returns the Service Pack on the computer and writes it to a text file..

Code:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("c:\scripts\test.txt", True)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
    ("SELECT * FROM Win32_OperatingSystem")
objTextFile.WriteLine "ServicePackVersion"
For Each objOperatingSystems in colOperatingSystems
objTextFile.WriteLine objOperatingSystems.ServicePackMajorVersion  _
        & "." & objOperatingSystems.ServicePackMinorVersion
Next
ObjTextFile.Close


Now by changing the strComputer ="whatever" I'm able to query different computers.

So, What I want to do is set this up so it will grab the ComputerName field from the Subform, and update the information for that certain computer.

I appreciate your help!
 
Grab the RecordSetClone of the SubForm and Loop through it.

Code:
DIM rst as DAO.RecordSet

Set rst = Me.Form.[SubForms Name].RecordSetClone

Do While Not rst.EOF

    '<Your Script Here setting the strComputer=to Recordset's equivalant>

     rst.MoveNext
Loop
 

Users who are viewing this thread

Back
Top Bottom