Across network access to data sources/db

Across network access to data sources/db

am 13.10.2006 18:47:44 von Poohba

I originally had a script that would log info into a file. I now want
to use it to log info into a db. The problem is I don't know how to
make this work across network. How do I get someone to connect to my
machine and use my data source instead of trying to use theirs which
does not exist? If its easier to just give the the data source then how
can I find ways of doing that? I would assume group policy would be the
best way but I have not been able to find this info yet.

The below script works locally but of course it doesn't work
network-wide. What do I need to make it work network wide? Can I add a
line to the script so that it knows to use my data source and database?

Dim Path, WSLSerialNumber
Dim objFileSystem, objOutputFile
Dim strOutputFile
Dim objDB,arrRecord,strRecord,strOutput 'JUST ADDED
Dim oRS, nRec, oFld 'JUST ADDED

'Main Processing section 'JUST ADDED
'Database connection & select all from Table 'JUST ADDED
Set objDB = DBConnect()

Set FSO = CreateObject("Scripting.FileSystemObject")
Set WshNetwork = WScript.CreateObject("WScript.Network")

' ---------Get Serial Number from WMI \root\cimv2 & WIN32_BIOS
strComputer = "."
'-----------------------------------------
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colBIOS = objWMIService.ExecQuery _
("SELECT * FROM Win32_BIOS")
Set colItems = objWMIService.ExecQuery _
("SELECT * FROM Win32_Bus")


For Each objBIOS in colBIOS
'check to see if machine support smbios data
If objBios.smbiosPresent = "True" then
Else
WSLSerialNumber = "@NA"
End If


'For Each objItem in colItems

If objBIOS.SerialNumber <> "" Then
WSLSerialNumber = objBIOS.SerialNumber
Set TextFile = FSO.OpenTextFile("\\fileserver\shared\" &
WshNetwork.Computername & ".txt", 8, True)
TextFile.Writeline WshNetwork.Computername & ":" & WSLSerialNumber & ":"
& objBIOS.SerialNumber & ":" & wshNetwork.UserName

Set oRS = objDB.Execute("insert into computers.login
(serial,machine,user,date,time) values('" & WSLSerialNumber & "','" &
WshNetwork.Computername & "','" & wshNetwork.UserName &
"',now(),now())")

Set objFileSystem = Nothing

End if
Next

If WSLSerialNumber = "" Then
WSLSerialNumber = "@NA"
End if

'Procedures section
'This function sets up DB Connection using specified DSN
Function DBConnect
Set objDB = CreateObject("ADODB.Connection")
objDB.Open "mysqlodbc"
Set DBConnect = objDB
End Function




--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org