RE: [ActiveDir] CPU/Memory usage .vbs?
Anyone? From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Harding, Devon Sent: Tuesday, January 24, 2006 1:09 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] CPU/Memory usage .vbs? Got everything working I just need to get the value of _Total instance instead of 0 _Total Working script: oFileName = c:\cpuuse.txt Set FSO = CreateObject(Scripting.FileSystemObject) Set oFile = FSO.CreateTextFile(oFileName, True) strComputer = . Set objWMIService = GetObject(winmgmts:\\ strComputer \root\CIMV2) Set colItems = objWMIService.ExecQuery(SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor,,48) For Each objItem in colItems Wscript.Echo Processor Time: objItem.PercentProcessorTime % oFile.WriteLine Processor Time: objItem.PercentProcessorTime % Next From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Harding, Devon Sent: Tuesday, January 24, 2006 12:02 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] CPU/Memory usage .vbs? Ok modified it a bit; and now working: oFileName = c:\cpuuse.txt Set FSO = CreateObject(Scripting.FileSystemObject) Set oFile = FSO.CreateTextFile(oFileName, True) strComputer = . Set objWMIService = GetObject(winmgmts:\\ strComputer \root\CIMV2) Set colItems = objWMIService.ExecQuery( _ SELECT * FROM Win32_PerfRawData_PerfOS_Processor,,48) For Each objItem in colItems Wscript.Echo PercentProcessorTime: objItem.PercentProcessorTime oFile.WriteLine PercentProcessorTime: objItem.PercentProcessorTime Next From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Coleman, Hunter Sent: Tuesday, January 24, 2006 10:58 AM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] CPU/Memory usage .vbs? The error message is pretty accurate :-) Try it this way oFileName = Inputbox(c:\cpuuse.txt,CPU Usage,CPUuse.txt) Set FSO = CreateObject(Scripting.FileSystemObject) Set oFile = FSO.CreateTextFile(oFileName, True) strComputer = . Set objWMIService = GetObject(winmgmts:\\ strComputer \root\CIMV2) Set colItems = objWMIService.ExecQuery( _ SELECT * FROM Win32_PerfRawData_PerfOS_Processor,,48) For Each objItem in colItems Wscript.Echo PercentProcessorTime: objItem.PercentProcessorTime oFile.WriteLineobjItem.PercentProcessorTime Next From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Harding, Devon Sent: Tuesday, January 24, 2006 8:25 AM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] CPU/Memory usage .vbs? This is what I have. But I get an Object Required on intProcessoeUse strComputer = . Set objWMIService = GetObject(winmgmts:\\ strComputer \root\CIMV2) Set colItems = objWMIService.ExecQuery( _ SELECT * FROM Win32_PerfRawData_PerfOS_Processor,,48) For Each objItem in colItems Wscript.Echo PercentProcessorTime: objItem.PercentProcessorTime Next oFileName = Inputbox(c:\cpuuse.txt,CPU Usage,CPUuse.txt) Set FSO = CreateObject(Scripting.FileSystemObject) Set oFile = FSO.CreateTextFile(oFileName, True) oFile.WriteLine intProcessorUse.PercentProcessorTime From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Derek Harris Sent: Monday, January 23, 2006 3:49 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] CPU/Memory usage .vbs? 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: ActiveDir@mail.activedir.org 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
RE: [ActiveDir] CPU/Memory usage .vbs?
This is what I have. But I get an Object Required on intProcessoeUse strComputer = . Set objWMIService = GetObject(winmgmts:\\ strComputer \root\CIMV2) Set colItems = objWMIService.ExecQuery( _ SELECT * FROM Win32_PerfRawData_PerfOS_Processor,,48) For Each objItem in colItems Wscript.Echo PercentProcessorTime: objItem.PercentProcessorTime Next oFileName = Inputbox(c:\cpuuse.txt,CPU Usage,CPUuse.txt) Set FSO = CreateObject(Scripting.FileSystemObject) Set oFile = FSO.CreateTextFile(oFileName, True) oFile.WriteLine intProcessorUse.PercentProcessorTime From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Derek Harris Sent: Monday, January 23, 2006 3:49 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] CPU/Memory usage .vbs? 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: ActiveDir@mail.activedir.org 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 Sent: Sunday, January 22, 2006 11:52 AM To: ActiveDir@mail.activedir.org Subject: Re: [ActiveDir] CPU/Memory usage .vbs? WMI is a pretty easy way to get this done. What's your comfort level with scripting? Have you seen this? http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/monitoring/performance/ 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? From: [EMAIL PROTECTED] on behalf of Michael B. Smith Sent: Sat 1/21/2006 6:14 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] OT: .vbs mailing list? Although my most useful information about tough _vbscript_ questions has come from here and from Robbie Allen's various books, there is [EMAIL PROTECTED]. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Harding, Devon Sent: Saturday, January 21, 2006 12:17 PM To: ActiveDir@mail.activedir.org Subject: [ActiveDir] OT: .vbs mailing list? Is there a VBSript mailing list out there? -Devon - __ This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use or distribution of the information included in the message and any attachments is prohibited.If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments.Thank You. List info : http://www.activedir.org/List..aspx List FAQ: http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/ List info : http://www.activedir.org/List..aspx List FAQ: http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/ List info : http://www.activedir.org/List..aspx List FAQ: http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org
RE: [ActiveDir] CPU/Memory usage .vbs?
strComputer = . Set objWMIService = GetObject(winmgmts:\\ strComputer \root\CIMV2) Set colItems = objWMIService.ExecQuery(_ SELECT * FROM Win32_PerfRawData_PerfOS_Processor,,48) For Each objItem in colItems strOutput = strOutput vbNewLine objItem.PercentProcessorTime Next oFileName = Inputbox(c:\cpuuse.txt,CPU Usage,CPUuse.txt) Set FSO = CreateObject(Scripting.FileSystemObject) Set oFile = FSO.CreateTextFile(oFileName, True) oFile.WriteLine strOutput there was no object defined for intProcessorUse and it wouldnt have output something for each instance, if there is more than one item in objItems (mine has 3) --- Rich Milburn MCSE, Microsoft MVP - Directory Services Sr Network Analyst, Field Platform Development Applebee's International, Inc. 4551 W. 107th St Overland Park, KS 66207 913-967-2819 -- I love the smell of red herrings in the morning - anonymous From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Harding, Devon Sent: Tuesday, January 24, 2006 9:25 AM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] CPU/Memory usage .vbs? This is what I have. But I get an Object Required on intProcessoeUse strComputer = . Set objWMIService = GetObject(winmgmts:\\ strComputer \root\CIMV2) Set colItems = objWMIService.ExecQuery( _ SELECT * FROM Win32_PerfRawData_PerfOS_Processor,,48) For Each objItem in colItems Wscript.Echo PercentProcessorTime: objItem.PercentProcessorTime Next oFileName = Inputbox(c:\cpuuse.txt,CPU Usage,CPUuse.txt) Set FSO = CreateObject(Scripting.FileSystemObject) Set oFile = FSO.CreateTextFile(oFileName, True) oFile.WriteLine intProcessorUse.PercentProcessorTime From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Derek Harris Sent: Monday, January 23, 2006 3:49 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] CPU/Memory usage .vbs? 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: ActiveDir@mail.activedir.org 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 Sent: Sunday, January 22, 2006 11:52 AM To: ActiveDir@mail.activedir.org Subject: Re: [ActiveDir] CPU/Memory usage .vbs? WMI is a pretty easy way to get this done. What's your comfort level with scripting? Have you seen this? http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/monitoring/performance/ 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? From: [EMAIL PROTECTED] on behalf of Michael B. Smith Sent: Sat 1/21/2006 6:14 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] OT: .vbs mailing list? Although my most useful information about tough _vbscript_ questions has come from here and from Robbie Allen's various books, there is [EMAIL PROTECTED]. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Harding, Devon Sent: Saturday, January 21, 2006 12:17 PM To: ActiveDir@mail.activedir.org Subject: [ActiveDir] OT: .vbs mailing list? Is there a VBSript mailing list out there? -Devon - __ This message
RE: [ActiveDir] CPU/Memory usage .vbs?
The error message is pretty accurate :-) Try it this way oFileName = Inputbox("c:\cpuuse.txt","CPU Usage","CPUuse.txt") Set FSO = CreateObject("Scripting.FileSystemObject") Set oFile = FSO.CreateTextFile(oFileName, True) strComputer = "." Set objWMIService = GetObject("winmgmts:\\" strComputer "\root\CIMV2") Set colItems = objWMIService.ExecQuery( _ "SELECT * FROM Win32_PerfRawData_PerfOS_Processor",,48) For Each objItem in colItems Wscript.Echo "PercentProcessorTime: " objItem.PercentProcessorTime oFile.WriteLineobjItem.PercentProcessorTime Next From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Harding, DevonSent: Tuesday, January 24, 2006 8:25 AMTo: ActiveDir@mail.activedir.orgSubject: RE: [ActiveDir] CPU/Memory usage .vbs? This is what I have. But I get an Object Required on intProcessoeUse strComputer = "." Set objWMIService = GetObject("winmgmts:\\" strComputer "\root\CIMV2") Set colItems = objWMIService.ExecQuery( _ "SELECT * FROM Win32_PerfRawData_PerfOS_Processor",,48) For Each objItem in colItems Wscript.Echo "PercentProcessorTime: " objItem.PercentProcessorTime Next oFileName = Inputbox("c:\cpuuse.txt","CPU Usage","CPUuse.txt") Set FSO = CreateObject("Scripting.FileSystemObject") Set oFile = FSO.CreateTextFile(oFileName, True) oFile.WriteLine intProcessorUse.PercentProcessorTime From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Derek HarrisSent: Monday, January 23, 2006 3:49 PMTo: ActiveDir@mail.activedir.orgSubject: RE: [ActiveDir] CPU/Memory usage .vbs? 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, DevonSent: Monday, January 23, 2006 12:47 PMTo: ActiveDir@mail.activedir.orgSubject: 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 MulnickSent: Sunday, January 22, 2006 11:52 AMTo: ActiveDir@mail.activedir.orgSubject: Re: [ActiveDir] CPU/Memory usage .vbs? WMI is a pretty easy way to get this done. What's your comfort level with scripting? Have you seen this? http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/monitoring/performance/ 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? From: [EMAIL PROTECTED] on behalf of Michael B. SmithSent: Sat 1/21/2006 6:14 PMTo: ActiveDir@mail.activedir.orgSubject: RE: [ActiveDir] OT: .vbs mailing list?Although my most useful information about tough _vbscript_ questions hascome from here and from Robbie Allen's various books, there is [EMAIL PROTECTED].-Original Message-From: [EMAIL PROTECTED][mailto:[EMAIL PROTECTED]] On Behalf Of Harding, DevonSent: Saturday, January 21, 2006 12:17 PMTo: ActiveDir@mail.activedir.orgSubject: [ActiveDir] OT: .vbs mailing list?Is there a VBSript mailing list out there?-Devon-__ This message and any attachments are solely for the intendedrecipient and may contain confidential or privileged information.If you are not the intended recipient, any disclosure, copying, useor distribution of the informati
RE: [ActiveDir] CPU/Memory usage .vbs?
Ok modified it a bit; and now working: oFileName = c:\cpuuse.txt Set FSO = CreateObject(Scripting.FileSystemObject) Set oFile = FSO.CreateTextFile(oFileName, True) strComputer = . Set objWMIService = GetObject(winmgmts:\\ strComputer \root\CIMV2) Set colItems = objWMIService.ExecQuery( _ SELECT * FROM Win32_PerfRawData_PerfOS_Processor,,48) For Each objItem in colItems Wscript.Echo PercentProcessorTime: objItem.PercentProcessorTime oFile.WriteLine PercentProcessorTime: objItem.PercentProcessorTime Next From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Coleman, Hunter Sent: Tuesday, January 24, 2006 10:58 AM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] CPU/Memory usage .vbs? The error message is pretty accurate :-) Try it this way oFileName = Inputbox(c:\cpuuse.txt,CPU Usage,CPUuse.txt) Set FSO = CreateObject(Scripting.FileSystemObject) Set oFile = FSO.CreateTextFile(oFileName, True) strComputer = . Set objWMIService = GetObject(winmgmts:\\ strComputer \root\CIMV2) Set colItems = objWMIService.ExecQuery( _ SELECT * FROM Win32_PerfRawData_PerfOS_Processor,,48) For Each objItem in colItems Wscript.Echo PercentProcessorTime: objItem.PercentProcessorTime oFile.WriteLineobjItem.PercentProcessorTime Next From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Harding, Devon Sent: Tuesday, January 24, 2006 8:25 AM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] CPU/Memory usage .vbs? This is what I have. But I get an Object Required on intProcessoeUse strComputer = . Set objWMIService = GetObject(winmgmts:\\ strComputer \root\CIMV2) Set colItems = objWMIService.ExecQuery( _ SELECT * FROM Win32_PerfRawData_PerfOS_Processor,,48) For Each objItem in colItems Wscript.Echo PercentProcessorTime: objItem.PercentProcessorTime Next oFileName = Inputbox(c:\cpuuse.txt,CPU Usage,CPUuse.txt) Set FSO = CreateObject(Scripting.FileSystemObject) Set oFile = FSO.CreateTextFile(oFileName, True) oFile.WriteLine intProcessorUse.PercentProcessorTime From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Derek Harris Sent: Monday, January 23, 2006 3:49 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] CPU/Memory usage .vbs? 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: ActiveDir@mail.activedir.org 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 Sent: Sunday, January 22, 2006 11:52 AM To: ActiveDir@mail.activedir.org Subject: Re: [ActiveDir] CPU/Memory usage .vbs? WMI is a pretty easy way to get this done. What's your comfort level with scripting? Have you seen this? http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/monitoring/performance/ 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? From: [EMAIL PROTECTED] on behalf of Michael B. Smith Sent: Sat 1/21/2006 6:14 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] OT: .vbs mailing list? Although my most useful information about tough _vbscript_ questions has come from here and from Robbie Allen's various books, there is [EMAIL PROTECTED]. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf
RE: [ActiveDir] CPU/Memory usage .vbs?
Got everything working I just need to get the value of _Total instance instead of 0 _Total Working script: oFileName = c:\cpuuse.txt Set FSO = CreateObject(Scripting.FileSystemObject) Set oFile = FSO.CreateTextFile(oFileName, True) strComputer = . Set objWMIService = GetObject(winmgmts:\\ strComputer \root\CIMV2) Set colItems = objWMIService.ExecQuery(SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor,,48) For Each objItem in colItems Wscript.Echo Processor Time: objItem.PercentProcessorTime % oFile.WriteLine Processor Time: objItem.PercentProcessorTime % Next From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Harding, Devon Sent: Tuesday, January 24, 2006 12:02 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] CPU/Memory usage .vbs? Ok modified it a bit; and now working: oFileName = c:\cpuuse.txt Set FSO = CreateObject(Scripting.FileSystemObject) Set oFile = FSO.CreateTextFile(oFileName, True) strComputer = . Set objWMIService = GetObject(winmgmts:\\ strComputer \root\CIMV2) Set colItems = objWMIService.ExecQuery( _ SELECT * FROM Win32_PerfRawData_PerfOS_Processor,,48) For Each objItem in colItems Wscript.Echo PercentProcessorTime: objItem.PercentProcessorTime oFile.WriteLine PercentProcessorTime: objItem.PercentProcessorTime Next From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Coleman, Hunter Sent: Tuesday, January 24, 2006 10:58 AM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] CPU/Memory usage .vbs? The error message is pretty accurate :-) Try it this way oFileName = Inputbox(c:\cpuuse.txt,CPU Usage,CPUuse.txt) Set FSO = CreateObject(Scripting.FileSystemObject) Set oFile = FSO.CreateTextFile(oFileName, True) strComputer = . Set objWMIService = GetObject(winmgmts:\\ strComputer \root\CIMV2) Set colItems = objWMIService.ExecQuery( _ SELECT * FROM Win32_PerfRawData_PerfOS_Processor,,48) For Each objItem in colItems Wscript.Echo PercentProcessorTime: objItem.PercentProcessorTime oFile.WriteLineobjItem.PercentProcessorTime Next From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Harding, Devon Sent: Tuesday, January 24, 2006 8:25 AM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] CPU/Memory usage .vbs? This is what I have. But I get an Object Required on intProcessoeUse strComputer = . Set objWMIService = GetObject(winmgmts:\\ strComputer \root\CIMV2) Set colItems = objWMIService.ExecQuery( _ SELECT * FROM Win32_PerfRawData_PerfOS_Processor,,48) For Each objItem in colItems Wscript.Echo PercentProcessorTime: objItem.PercentProcessorTime Next oFileName = Inputbox(c:\cpuuse.txt,CPU Usage,CPUuse.txt) Set FSO = CreateObject(Scripting.FileSystemObject) Set oFile = FSO.CreateTextFile(oFileName, True) oFile.WriteLine intProcessorUse.PercentProcessorTime From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Derek Harris Sent: Monday, January 23, 2006 3:49 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] CPU/Memory usage .vbs? 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: ActiveDir@mail.activedir.org 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 Sent: Sunday, January 22, 2006 11:52 AM To: ActiveDir@mail.activedir.org Subject: Re: [ActiveDir] CPU/Memory usage .vbs? WMI is a pretty easy way to get this done
RE: [ActiveDir] CPU/Memory usage .vbs?
Have a look at http://www.lissware.net, Volume 1 Sample 5.18 to 5.19 - WatchInstanceStateWithRefreshMethod.wsf Sample 5.20 - WatchInstanceCollectionStateWithRefresher.wsf Volume 2 Sample 3.77 to 3.78 - WMICounterMonitor.wsf Sample 3.79 - PerfMonProv.mof Sample 3.80 - PerfMonClasses.Mof Sample 3.81 - NTProcesses.wsf All these scripts represent techniques and technologies to gather such a data. You can also have a look at http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx WMI Code Creator v1.0 can also help you: http://www.microsoft.com/downloads/details.aspx?FamilyID=2cc30a64-ea15-4661-8da4-55bbc145c30eDisplayLang=en HTH /Alain From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of joeSent: Sunday, January 22, 2006 7:47 PMTo: ActiveDir@mail.activedir.orgSubject: RE: [ActiveDir] CPU/Memory usage .vbs? Yeah I think WMI is about it for you for this type of stuff from script. Look through the archives for posts from Alain Lissoir (PM for WMI at MS) as he has several links for free tools to automate creating scripts to gather info like this. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Al MulnickSent: Sunday, January 22, 2006 11:52 AMTo: ActiveDir@mail.activedir.orgSubject: Re: [ActiveDir] CPU/Memory usage .vbs? WMI is a pretty easy way to get this done. What's your comfort level with scripting? Have you seen this? http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/monitoring/performance/ 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? From: [EMAIL PROTECTED] on behalf of Michael B. SmithSent: Sat 1/21/2006 6:14 PMTo: ActiveDir@mail.activedir.orgSubject: RE: [ActiveDir] OT: .vbs mailing list?Although my most useful information about tough _vbscript_ questions hascome from here and from Robbie Allen's various books, there is [EMAIL PROTECTED].-Original Message-From: [EMAIL PROTECTED][mailto:[EMAIL PROTECTED]] On Behalf Of Harding, DevonSent: Saturday, January 21, 2006 12:17 PMTo: ActiveDir@mail.activedir.orgSubject: [ActiveDir] OT: .vbs mailing list?Is there a VBSript mailing list out there?-Devon-__ This message and any attachments are solely for the intendedrecipient and may contain confidential or privileged information.If you are not the intended recipient, any disclosure, copying, useor distribution of the information included in the message and any attachments is prohibited.If you have received this communicationin error, please notify us by reply e-mail and immediately andpermanently delete this message and any attachments.Thank You.List info : http://www.activedir.org/List.aspxList FAQ: http://www.activedir.org/ListFAQ.aspxList archive:http://www.mail-archive.com/activedir%40mail.activedir.org/List info : http://www.activedir.org/List.aspxList FAQ: http://www.activedir.org/ListFAQ.aspxList archive: http://www.mail-archive.com/activedir%40mail.activedir.org/List info : http://www.activedir.org/List.aspxList FAQ: http://www.activedir.org/ListFAQ.aspxList archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
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 Sent: Sunday, January 22, 2006 11:52 AM To: ActiveDir@mail.activedir.org Subject: Re: [ActiveDir] CPU/Memory usage .vbs? WMI is a pretty easy way to get this done. What's your comfort level with scripting? Have you seen this? http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/monitoring/performance/ 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? From: [EMAIL PROTECTED] on behalf of Michael B. Smith Sent: Sat 1/21/2006 6:14 PM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] OT: .vbs mailing list? Although my most useful information about tough _vbscript_ questions has come from here and from Robbie Allen's various books, there is [EMAIL PROTECTED]. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Harding, Devon Sent: Saturday, January 21, 2006 12:17 PM To: ActiveDir@mail.activedir.org Subject: [ActiveDir] OT: .vbs mailing list? Is there a VBSript mailing list out there? -Devon - __ This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use or distribution of the information included in the message and any attachments is prohibited.If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments.Thank You. List info : http://www.activedir.org/List.aspx List FAQ: http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/ List info : http://www.activedir.org/List.aspx List FAQ: http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/ List info : http://www.activedir.org/List.aspx List FAQ: http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
RE: [ActiveDir] CPU/Memory usage .vbs?
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, DevonSent: Monday, January 23, 2006 12:47 PMTo: ActiveDir@mail.activedir.orgSubject: 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 MulnickSent: Sunday, January 22, 2006 11:52 AMTo: ActiveDir@mail.activedir.orgSubject: Re: [ActiveDir] CPU/Memory usage .vbs? WMI is a pretty easy way to get this done. What's your comfort level with scripting? Have you seen this? http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/monitoring/performance/ 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? From: [EMAIL PROTECTED] on behalf of Michael B. SmithSent: Sat 1/21/2006 6:14 PMTo: ActiveDir@mail.activedir.orgSubject: RE: [ActiveDir] OT: .vbs mailing list?Although my most useful information about tough _vbscript_ questions hascome from here and from Robbie Allen's various books, there is [EMAIL PROTECTED].-Original Message-From: [EMAIL PROTECTED][mailto:[EMAIL PROTECTED]] On Behalf Of Harding, DevonSent: Saturday, January 21, 2006 12:17 PMTo: ActiveDir@mail.activedir.orgSubject: [ActiveDir] OT: .vbs mailing list?Is there a VBSript mailing list out there?-Devon-__ This message and any attachments are solely for the intendedrecipient and may contain confidential or privileged information.If you are not the intended recipient, any disclosure, copying, useor distribution of the information included in the message and any attachments is prohibited.If you have received this communicationin error, please notify us by reply e-mail and immediately andpermanently delete this message and any attachments.Thank You.List info : http://www.activedir.org/List.aspxList FAQ: http://www.activedir.org/ListFAQ.aspxList archive:http://www.mail-archive.com/activedir%40mail.activedir.org/List info : http://www.activedir.org/List.aspxList FAQ: http://www.activedir.org/ListFAQ.aspxList archive: http://www.mail-archive.com/activedir%40mail.activedir.org/List info : http://www.activedir.org/List.aspxList FAQ: http://www.activedir.org/ListFAQ.aspxList archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
Re: [ActiveDir] CPU/Memory usage .vbs?
WMI is a pretty easy way to get this done. What's your comfort level with scripting? Have you seen this? http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/monitoring/performance/ 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? From: [EMAIL PROTECTED] on behalf of Michael B. SmithSent: Sat 1/21/2006 6:14 PMTo: ActiveDir@mail.activedir.orgSubject: RE: [ActiveDir] OT: .vbs mailing list?Although my most useful information about tough _vbscript_ questions hascome from here and from Robbie Allen's various books, there is [EMAIL PROTECTED].-Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Harding, DevonSent: Saturday, January 21, 2006 12:17 PMTo: ActiveDir@mail.activedir.orgSubject: [ActiveDir] OT: .vbs mailing list?Is there a VBSript mailing list out there?-Devon-__ This message and any attachments are solely for the intendedrecipient and may contain confidential or privileged information.If you are not the intended recipient, any disclosure, copying, useor distribution of the information included in the message and any attachments is prohibited.If you have received this communicationin error, please notify us by reply e-mail and immediately andpermanently delete this message and any attachments.Thank You.List info : http://www.activedir.org/List.aspxList FAQ: http://www.activedir.org/ListFAQ.aspxList archive: http://www.mail-archive.com/activedir%40mail.activedir.org/List info : http://www.activedir.org/List.aspxList FAQ: http://www.activedir.org/ListFAQ.aspxList archive: http://www.mail-archive.com/activedir%40mail.activedir.org/List info : http://www.activedir.org/List.aspxList FAQ: http://www.activedir.org/ListFAQ.aspxList archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
RE: [ActiveDir] CPU/Memory usage .vbs?
Yeah I think WMI is about it for you for this type of stuff from script. Look through the archives for posts from Alain Lissoir (PM for WMI at MS) as he has several links for free tools to automate creating scripts to gather info like this. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Al MulnickSent: Sunday, January 22, 2006 11:52 AMTo: ActiveDir@mail.activedir.orgSubject: Re: [ActiveDir] CPU/Memory usage .vbs? WMI is a pretty easy way to get this done. What's your comfort level with scripting? Have you seen this? http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/monitoring/performance/ 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? From: [EMAIL PROTECTED] on behalf of Michael B. SmithSent: Sat 1/21/2006 6:14 PMTo: ActiveDir@mail.activedir.orgSubject: RE: [ActiveDir] OT: .vbs mailing list?Although my most useful information about tough _vbscript_ questions hascome from here and from Robbie Allen's various books, there is [EMAIL PROTECTED].-Original Message-From: [EMAIL PROTECTED][mailto:[EMAIL PROTECTED]] On Behalf Of Harding, DevonSent: Saturday, January 21, 2006 12:17 PMTo: ActiveDir@mail.activedir.orgSubject: [ActiveDir] OT: .vbs mailing list?Is there a VBSript mailing list out there?-Devon-__ This message and any attachments are solely for the intendedrecipient and may contain confidential or privileged information.If you are not the intended recipient, any disclosure, copying, useor distribution of the information included in the message and any attachments is prohibited.If you have received this communicationin error, please notify us by reply e-mail and immediately andpermanently delete this message and any attachments.Thank You.List info : http://www.activedir.org/List.aspxList FAQ: http://www.activedir.org/ListFAQ.aspxList archive:http://www.mail-archive.com/activedir%40mail.activedir.org/List info : http://www.activedir.org/List.aspxList FAQ: http://www.activedir.org/ListFAQ.aspxList archive: http://www.mail-archive.com/activedir%40mail.activedir.org/List info : http://www.activedir.org/List.aspxList FAQ: http://www.activedir.org/ListFAQ.aspxList archive: http://www.mail-archive.com/activedir%40mail.activedir.org/