Get-Memory status via PowerShell

Function Get-MemoryProcessUsage {
[cmdletbinding()]
Param()
$CompObject = Get-WmiObject -Class WIN32_OperatingSystem
M e m o r y = [ i n t ] ( ( ( Memory =[int]((( Memory=[int](((CompObject.TotalVisibleMemorySize - $CompObject.FreePhysicalMemory)*100)/ $CompObject.TotalVisibleMemorySize)

Write-Host “Memory usage in Percentage:” $Memory"%"

Top 5 process Memory Usage (MB)

KaTeX parse error: Expected '}', got 'EOF' at end of input: …{[math]::round(_.ws / 1mb)}}
$processMemoryUsage

}

Function Get-MemoryUsage {
[cmdletbinding()]
Param()
KaTeX parse error: Expected '}', got 'EOF' at end of input: …{[math]::Round(.FreePhysicalMemory/1mb,2)}},
@{Name = “UsageGB”;Expression = { int-[math]::Round(KaTeX parse error: Expected 'EOF', got '}' at position 28: …alMemory/1mb,2)}̲}, @{Name = "To…
.TotalVisibleMemorySize/1mb)}}

p c t F r e e = [ m a t h ] : : R o u n d ( ( pctFree = [math]::Round(( pctFree=[math]::Round((os.FreePhysicalMemory/$os.TotalVisibleMemorySize)*100,2)
KaTeX parse error: Expected '}', got 'EOF' at end of input: … Expression = {pctFree}},
@{Name = “FreeGB”;Expression = {[math]::Round(KaTeX parse error: Expected 'EOF', got '}' at position 28: …alMemory/1mb,2)}̲}, @{Name = "Us….TotalVisibleMemorySize/1mb)-[math]::Round(KaTeX parse error: Expected 'EOF', got '}' at position 28: …alMemory/1mb,2)}̲}, @{Name = "To….TotalVisibleMemorySize/1mb)}}

}

Function Get-PagefileUsage {
[cmdletbinding()]
Param()

$PageUsage= Get-CimInstance Win32_PageFileUsage | Select-Object Name,CurrentUsage,AllocatedBaseSize,PeakUsage,InstallDate

KaTeX parse error: Expected '}', got 'EOF' at end of input: …;Expression = {.Name}},
@{Name = “CurrentUsage(MB)”;Expression = {KaTeX parse error: Expected 'EOF', got '}' at position 15: _.CurrentUsage}̲}, @{Name = "Al…
.AllocatedBaseSize}},
@{Name = “PeakUsage(MB)”;Expression = {$_.PeakUsage}}

#@{Name = “InstallDate”;Expression = {$_.InstallDate}} | Format-Table -AutoSize

}

Start-Sleep 240
gwmi -Class win32_SERVICE | where{$.State -eq ‘Stopped’ -and $.startmode -eq ‘Auto’} | Start-Service

$os = Get-WmiObject -Class win32_operatingsystem
b o o t = ( [ w m i ] " " ) . C o n v e r t T o D a t e T i m e ( boot = ([wmi]"").ConvertToDateTime( boot=([wmi]"").ConvertToDateTime(os.LastBootuptime)

KaTeX parse error: Undefined control sequence: \Processor at position 33: …nter -Counter "\̲P̲r̲o̲c̲e̲s̲s̲o̲r̲(_Total)\% Proc…cpu)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值