0
我更新PS 1.0到4.0,我的脚本不工作。更新后PowerShell脚本不工作
它说:
Method invocation failed because [System.Object[]] does not contain a method na
med 'op_Division'.
At C:\Users\sabrnpet\Documents\rsm-monitoring-killer.ps1:18 char:5
+ if ($test/1KB -ge $consumed)
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (op_Division:String) [], Runti
meException
+ FullyQualifiedErrorId : MethodNotFound
下面是脚本:
### EDIT ME ####
$process = "opera" # BMCRSM
$consumed = 4500000 # in kilobytes
################
# checking if process is running
if (-not (Get-Process $process -ea 0))
{
Write-Host "Process $process is not running"
Exit
}
# variables
$getProcess = Get-Process $process
# checking if process eating much ram
if ($getProcess.WorkingSet64/1KB -ge $consumed)
{
Write-Host "I will termiante it..."
$getProcess.Kill()
}
else
{
Write-Host "OK"
}
我已了解,有与千字节我想divison问题,但我需要以KB为单位此值。那么请怎么做?
的Thanko你