powershell performance improvements
This commit is contained in:
parent
9f1bc29b75
commit
909f4e227f
@ -745,7 +745,7 @@ function versions(apps, callback) {
|
||||
});
|
||||
} else {
|
||||
if (_windows) {
|
||||
util.powerShell('Get-WmiObject Win32_Service | fl *').then((stdout) => {
|
||||
util.powerShell('Get-WmiObject Win32_Service | select caption | fl').then((stdout) => {
|
||||
let serviceSections = stdout.split(/\n\s*\n/);
|
||||
for (let i = 0; i < serviceSections.length; i++) {
|
||||
if (serviceSections[i].trim() !== '') {
|
||||
@ -1140,7 +1140,7 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
|
||||
if (process.arch === 'ia32' && Object.prototype.hasOwnProperty.call(process.env, 'PROCESSOR_ARCHITEW6432')) {
|
||||
sysdir = '%windir%\\sysnative\\cmd.exe /c %windir%\\System32';
|
||||
}
|
||||
util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | fl *').then((stdout) => {
|
||||
util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => {
|
||||
// let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0)[0].trim().split(/\s\s+/);
|
||||
let lines = stdout.split('\r\n');
|
||||
result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
|
||||
|
||||
@ -332,7 +332,7 @@ function services(srv, callback) {
|
||||
}
|
||||
wincommand = `${wincommand.slice(0, -4)}"`;
|
||||
}
|
||||
wincommand += ' | fl *';
|
||||
wincommand += ' | select Name,Caption,Started,StartMode,ProcessId | fl';
|
||||
util.powerShell(wincommand).then((stdout, error) => {
|
||||
if (!error) {
|
||||
let serviceSections = stdout.split(/\n\s*\n/);
|
||||
@ -797,7 +797,7 @@ function processes(callback) {
|
||||
});
|
||||
} else if (_windows) {
|
||||
try {
|
||||
util.powerShell('Get-WmiObject Win32_Process | fl *').then((stdout, error) => {
|
||||
util.powerShell('Get-WmiObject Win32_Process | select ProcessId,ParentProcessId,ExecutionState,Caption,CommandLine,ExecutablePath,UserModeTime,KernelModeTime,WorkingSetSize,Priority,PageFileUsage,CreationDate | fl').then((stdout, error) => {
|
||||
if (!error) {
|
||||
let processSections = stdout.split(/\n\s*\n/);
|
||||
let procs = [];
|
||||
@ -969,7 +969,7 @@ function processLoad(proc, callback) {
|
||||
if (procSanitized && processes.length && processes[0] !== '------') {
|
||||
if (_windows) {
|
||||
try {
|
||||
util.powerShell('Get-WmiObject Win32_Process | fl *').then((stdout, error) => {
|
||||
util.powerShell('Get-WmiObject Win32_Process | select ProcessId,Caption,UserModeTime,KernelModeTime,WorkingSetSize | fl').then((stdout, error) => {
|
||||
if (!error) {
|
||||
let processSections = stdout.split(/\n\s*\n/);
|
||||
let procStats = [];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user