|
Very easily; just put the following lines near the
top:
oFileName = Inputbox("Enter the path and filename to save
the info.","CPU Usage","CPUuse.txt")
Set FSO = CreateObject("Scripting.FileSystemObject") Set oFile = FSO.CreateTextFile(oFileName, True) and put an
oFile.WriteLine, with whatever data you want, wherever you
want.
eg.
oFile.WriteLine
intProcessorUse.PercentProcessorTime
Of course, it's usually better to put the values into a
variable, and then do what you want with the
variable...
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Harding, Devon Sent: Monday, January 23, 2006 12:47 PM To: [email protected] Subject: RE: [ActiveDir] CPU/Memory usage & .vbs? This is
great! What I need is to use this code to output the current usage
percentage to a text file. Can this be done? strComputer = "."Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")set objRefresher = CreateObject("WbemScripting.Swbemrefresher")Set objProcessor = objRefresher.AddEnum _ (objWMIService, "Win32_PerfFormattedData_PerfOS_Processor").objectSetintThresholdViolations = 0objRefresher.RefreshDo For each intProcessorUse in objProcessor If intProcessorUse.PercentProcessorTime > 90 Then intThresholdViolations = intThresholdViolations + 1 If intThresholdViolations = 10 Then intThresholdViolations = 0 Wscript.Echo "Processor usage threshold exceeded." End If Else intThresholdViolations = 0 End If Next Wscript.Sleep 6000 objRefresher.RefreshLoop From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Al
Mulnick WMI is a pretty easy way to get this
done. What's your comfort level with scripting?
Have you seen this?
On 1/22/06, Harding, Devon <[EMAIL PROTECTED]>
wrote: That being said. I'm looking for
a script that will output the current memory usage (in percentage) & the top
cpu processes. Is this possible? wmi?
|
- RE: [ActiveDir] CPU/Memory usage & .vbs? Derek Harris
- RE: [ActiveDir] CPU/Memory usage & .vbs? Harding, Devon
- RE: [ActiveDir] CPU/Memory usage & .vbs? Rich Milburn
- RE: [ActiveDir] CPU/Memory usage & .vbs? Coleman, Hunter
- RE: [ActiveDir] CPU/Memory usage & .vbs? Harding, Devon
- RE: [ActiveDir] CPU/Memory usage & .vbs? Harding, Devon
- RE: [ActiveDir] CPU/Memory usage & .vbs? Harding, Devon
