Category Archive: Programming

Nov 25

How to find CPU Usage via Command line PowerShell.

rp_257109320_150_150.jpg

CPU Usage via Command line. @echo off Powershell -command “&{Get-WmiObject -Query ‘Select * from Win32_PerfFormattedData_PerfProc_Process ‘| Select Name, @{Name=’CPU(p)’;Expression={$_.PercentProcessorTime}} | where {$_.’CPU(p)’ -gt 0 } |Sort ‘CPU(p)’ -descending | Format-Table -AutoSize;}” CPU Usage via PowerShell Get-WmiObject -Query ‘Select * from Win32_PerfFormattedData_PerfProc_Process ‘| Select Name, @{Name=’CPU(p)’;Expression={$_.PercentProcessorTime}} | where {$_.’CPU(p)’ -gt 0 } |Sort ‘CPU(p)’ -descending | …

Continue reading »

Permanent link to this article: http://www.techxpress.in/how-to-find-cpu-usage-via-command-line-powershell/

Nov 25

Create Gridview from csv file in C sharp (C#)

rp_noimg_6_150_150.jpg

How to import data into Gridview from csv file by using C sharp ( C# ). Soln: //Read the data from text file string[] textData = System.IO.File.ReadAllLines(Server.MapPath(“Logs”) + \\MylogFile.log); string[] headers = textData[0].Split(‘,’);   //Create and populate DataTable DataTable dataTable1 = newDataTable(); foreach (string header in headers) dataTable1.Columns.Add(header, typeof(string), null);   for (int i = …

Continue reading »

Permanent link to this article: http://www.techxpress.in/create-gridview-from-csv-file-in-c-sharp-c/

Nov 22

Get window service information by WMI Query

How to find Window Service Name/ Service Path/ Service State for local or remote machine/server by using WMI? VBScript: arrComputers = Array(“localhost”) For Each strComputer In arrComputers WScript.Echo WScript.Echo “==========================================” WScript.Echo “Computer: ” & strComputer WScript.Echo “==========================================” Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\CIMV2″) Set colItems = objWMIService.ExecQuery( _ “SELECT * FROM Win32_Service”,,48) For …

Continue reading »

Permanent link to this article: http://www.techxpress.in/get-window-service-information-by-wmi-query/

Older posts «

» Newer posts

Bookmark this page