有一个powershell脚本正在我的服务器上运行,消耗了我32GB内存的99%。有什么东西可以让我识别它是什么脚本,在哪里?
tez616oj1#
以管理员身份打开Powershell提示符并运行以下两行:
$id = (Get-Process powershell | sort WorkingSet -Descending | select -first 1).Id Get-WmiObject Win32_Process -Filter "ProcessId = '$id'" | Select CommandLine
这将获得最繁忙的powershell进程的命令行。您需要以管理员身份运行它,否则命令行将为空。编辑:您可以使用这个一行程序来获取最繁忙的三个进程的命令行:
Get-Process powershell | sort WorkingSet -Descending | Select -First 3 | %{Get-WmiObject Win32_Process -Filter "ProcessId = $($_.Id)" | Select CommandLine}
yqyhoc1h2#
从管理PowerShell提示符中,首先获取所有PowerShell进程:
Get-Process PowerShell
确定引起问题的进程,并获取进程ID。现在使用WMI获取启动它的命令行:
Get-CimInstance Win32_Process -Filter "processid = '1234'" | Select Commandline
这应该为您提供了进一步调查的起点。
s3fp2yjn3#
不如这样:
get-process | sort ws
3条答案
按热度按时间tez616oj1#
以管理员身份打开Powershell提示符并运行以下两行:
这将获得最繁忙的powershell进程的命令行。您需要以管理员身份运行它,否则命令行将为空。
编辑:您可以使用这个一行程序来获取最繁忙的三个进程的命令行:
yqyhoc1h2#
从管理PowerShell提示符中,首先获取所有PowerShell进程:
确定引起问题的进程,并获取进程ID。现在使用WMI获取启动它的命令行:
这应该为您提供了进一步调查的起点。
s3fp2yjn3#
不如这样: