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)