Winrm 獲取遠端windows伺服器 cpu、磁碟、記憶體

青彥丶發表於2020-11-18
package com.sinosoft.common.utils;

import io.cloudsoft.winrm4j.client.WinRmClientContext;
import io.cloudsoft.winrm4j.winrm.WinRmTool;
import io.cloudsoft.winrm4j.winrm.WinRmToolResponse;
import org.apache.http.client.config.AuthSchemes;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author zyq
 * @Date 2020/6/1
 * @Description: 獲取遠端windows伺服器 cpu、磁碟、記憶體
 */
public final class WinrmForWindows {
    public static final String CPU_MEM_OCCUPANCY = "wmic cpu get LoadPercentage  /value";
    public static final String DISK_SPACE = "wmic LogicalDisk   get Caption, FreeSpace,Size/value";
    public static final String PHYSICAL_MEMORY = "systeminfo";
    public static final String LINE_SEPARATOR = System.getProperty("line.separator", "\n");
    public static final int 

相關文章