Hi ,
Please let me know In ASP, how to find the disk space in a server and the CPU utilizatcion . Please let me know the code in ASP to implement the same
Hi ,
Please let me know In ASP, how to find the disk space in a server and the CPU utilizatcion . Please let me know the code in ASP to implement the same
here you can fine disk space utilization code.
refer this article on how to get CPU utilization.Code:Option Explicit const strComputer = "." const strReport = "c:\diskspace.txt" Dim objWMIService, objItem, colItems Dim strDriveType, strDiskSize, txt Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk WHERE DriveType=3") txt = "Drive" & vbtab & "Size" & vbtab & "Used" & vbtab & "Free" & vbtab & "Free(%)" & vbcrlf For Each objItem in colItems DIM pctFreeSpace,strFreeSpace,strusedSpace pctFreeSpace = INT((objItem.FreeSpace / objItem.Size) * 1000)/10 strDiskSize = Int(objItem.Size /1073741824) & "Gb" strFreeSpace = Int(objItem.FreeSpace /1073741824) & "Gb" strUsedSpace = Int((objItem.Size-objItem.FreeSpace)/1073741824) & "Gb" txt = txt & objItem.Name & vbtab & strDiskSize & vbtab & strUsedSpace & vbTab & strFreeSpace & vbtab & pctFreeSpace & vbcrlf Next writeTextFile txt, strReport wscript.echo "Report written to " & strReport & vbcrlf & vbcrlf & txt ' Procedure to write output to a text file private sub writeTextFile(byval txt,byval strTextFilePath) Dim objFSO,objTextFile set objFSO = createobject("Scripting.FileSystemObject") set objTextFile = objFSO.CreateTextFile(strTextFilePath) objTextFile.Write(txt) objTextFile.Close SET objTextFile = nothing end sub
if you found this post is useful click * button (bottom side on this reply ) and agree
Jquery Shake Effect ,
JQUERY on Blogger
Thank You,
KiranK
Become Part of This Conversation
Join NowFor Free!