Find knowledge base article(s) by searching for keywords in the title e.g. type linux in the search box below
Find knowledge base article(s) by browsing the subject categories of articles
Technology quick references, cheatsheets, user manuals etc.
Shop Online through ShopifyLite
Tutorials on various IT applications.
Search Title    (UL:0 |SS:f)

Scripting >> Powershell >> 2.0 >> Examples

 

Download a web page

> $web = Net.WebClient

if get an error, try the following instead

> $web = [System.Net.WebClient]

> $web.DownloadString("http://www.example.com") 

 

To obtain the top 5 process by CPU percent utilization in decending order 

$CPUPercent = @{   
Name = 'CPUPercent'
Expression = {
$TotalSec = (New-TimeSpan -Start $_.StartTime).TotalSeconds
[Math]::Round( ($_.CPU * 100 / $TotalSec), 2) }
}

Get-Process | Select-Object -Property Name, CPU, $CPUPercent, Description |
Sort-Object -Property CPUPercent -Descending |
Select-Object -First 5

 

[ © 2008-2021 myfaqbase.com - A property of WPDC Consulting ]