My application runs long task on remote servers to to ensure they aren't maxed out I have a routine to check the CPU status of each server prior to use.
It appears as though the configuration is slighlty different on each server as one allows the request for information based on the standard window accound and the othe generates a Win32Exception due to lack of privledges.
Dim CPU As New PerformanceCounter
CPU.CategoryName = "Processor"
CPU.CounterName = "% Processor Time"
CPU.InstanceName = "_Total"
For Each Server As XElement In xdApplication.Descendants("Server")
CPU.MachineName = Server.Attribute("Val").Value
Dim Perf_CPU As Double
'Try
Perf_CPU = CPU.NextValue
System.Threading.Thread.Sleep(1000)
Perf_CPU = CPU.NextValue
dtServers.Rows.Add(Server.Attribute("Val").Value, Server.Attribute("Type").Value, Math.Round(Perf_CPU, 2).ToString)
'Catch ex As Exception
'dtServers.Rows.Add(Server.Attribute("Val").Value, Server.Attribute("Type").Value, "Unavalaible")
'End Try
Next
Working on the basis that the server to desktop configuration cannot be altered can the above process by run emulating a different useri (one that has correct permissions on the server) ?
It appears as though the configuration is slighlty different on each server as one allows the request for information based on the standard window accound and the othe generates a Win32Exception due to lack of privledges.
Dim CPU As New PerformanceCounter
CPU.CategoryName = "Processor"
CPU.CounterName = "% Processor Time"
CPU.InstanceName = "_Total"
For Each Server As XElement In xdApplication.Descendants("Server")
CPU.MachineName = Server.Attribute("Val").Value
Dim Perf_CPU As Double
'Try
Perf_CPU = CPU.NextValue
System.Threading.Thread.Sleep(1000)
Perf_CPU = CPU.NextValue
dtServers.Rows.Add(Server.Attribute("Val").Value, Server.Attribute("Type").Value, Math.Round(Perf_CPU, 2).ToString)
'Catch ex As Exception
'dtServers.Rows.Add(Server.Attribute("Val").Value, Server.Attribute("Type").Value, "Unavalaible")
'End Try
Next
Working on the basis that the server to desktop configuration cannot be altered can the above process by run emulating a different useri (one that has correct permissions on the server) ?