Greetings Gurus,
May I request your input please?
The goal:
Display dynamic system information on a form as it opens
The problem(s):
As above, I am trying to find a way to retrieve CPU usage, available RAM, physical disk activity and logged-on user on a form as it opens.
I have tested (exhaustively) using perfmon to log to a SQLExpress server but it will not connect across domains which is a necessity, i.e. computerA in domainA cannot send data to a SQL database running on computerB in domainB (unless there is something I have missed in my research)
I am therefore trying the programmatic approach by creating a user-agent which will run on computerA which will collect stats and upload them to computerB. I am hoping to get it to use the UDP protocol in the future but for now I would just like to find the most efficient, smallest footprint method of doing this.
It would seem that typeperf has a significantly smaller resource requirement that the other options (Perfmon/WMIC) and so am trying to find a way to capture typeperf data to a remote SQL server (without writing it to a file first).
I am currently testing the following code (see below) on a local machine running Access 2003 to see how efficient this process is.
The examples I have found thus far http://www.simple-talk.com/sql/performance/collecting-performance-data-into-a-sql-server-table/, http://www.vbaexpress.com/forum/archive/index.php/t-25198.html, http://www.xtremevbtalk.com/showthread.php?t=77334, http://www.java2s.com/Code/VBA-Excel-Access-Word/Windows-API/GetSystemMemorySize.htm and others seem very code-heavy.
Your input greatly appreciated and if anyone has a better, native-to-Windows way I would be eager to hear it.
May I request your input please?
The goal:
Display dynamic system information on a form as it opens
The problem(s):
As above, I am trying to find a way to retrieve CPU usage, available RAM, physical disk activity and logged-on user on a form as it opens.
I have tested (exhaustively) using perfmon to log to a SQLExpress server but it will not connect across domains which is a necessity, i.e. computerA in domainA cannot send data to a SQL database running on computerB in domainB (unless there is something I have missed in my research)
I am therefore trying the programmatic approach by creating a user-agent which will run on computerA which will collect stats and upload them to computerB. I am hoping to get it to use the UDP protocol in the future but for now I would just like to find the most efficient, smallest footprint method of doing this.
It would seem that typeperf has a significantly smaller resource requirement that the other options (Perfmon/WMIC) and so am trying to find a way to capture typeperf data to a remote SQL server (without writing it to a file first).
I am currently testing the following code (see below) on a local machine running Access 2003 to see how efficient this process is.
The examples I have found thus far http://www.simple-talk.com/sql/performance/collecting-performance-data-into-a-sql-server-table/, http://www.vbaexpress.com/forum/archive/index.php/t-25198.html, http://www.xtremevbtalk.com/showthread.php?t=77334, http://www.java2s.com/Code/VBA-Excel-Access-Word/Windows-API/GetSystemMemorySize.htm and others seem very code-heavy.
Your input greatly appreciated and if anyone has a better, native-to-Windows way I would be eager to hear it.
Code:
Dim strHostName, strUserDomain, strLogonServer As String
' environ$ is quicker than WMIC
strHostName = Environ$("computername")
strUserDomain = Environ$("userdomain")
strLogonServer = Environ$("logonserver")
'get dynamic metrics
' this is where I get stuck - how to you get Access to capture this output?
Shell "typeperf ""\Memory\Available bytes"" -sc 1", vbNormalFocus
'connect to SQL and write info
Dim MyConnObj As New ADODB.Connection
Dim myRecSet As New ADODB.Recordset
MyConnObj.Open _
"Provider = sqloledb.1;" & _
"Data Source = xx\SQLEXPRESS;" & _
"Initial Catalog = xx;" & _
"User ID = xx;" & _
"Password = xx;"
myRecSet.Open "select * from dbo.test1", MyConnObj, adOpenKeyset, adLockOptimistic
myRecSet.AddNew
myRecSet.Fields(1).Value = strHostName
myRecSet.Fields(2).Value = strUserDomain
myRecSet.Fields(3).Value = strLogonServer
myRecSet.Update
myRecSet.Close