Thursday, April 14, 2011

Does systeminfo command work for WIndows 2003?

is there a common command which can give the system information for windows2003 and above versions.

Thanks in advance

From stackoverflow
  • I have used it many times with windows xp,2003,vista its works fine

  • You also can script "system information acquisition" through WMI calls.

    alt text

    Use the WMIC Code Creator and a little VB script, and you can obtain precisely the informations you want/need, as opposed to the static systeminfo command.

    For instance:

    public string GetHardDisks() {
        ManagementObjectSearcher searcher = new
        ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_LogicalDisk"); 
        StringBuilder sb = new StringBuilder(); 
        foreach (ManagementObject wmi in searcher.Get()) {
            try {
                sb.Append("Drive Device ID: " +
                wmi.GetPropertyValue("DeviceID").ToString() +Environment.NewLine);
                sb.Append("Caption: " + wmi.GetPropertyValue("Caption").ToString() + Environment.NewLine);
                sb.Append("Volume Serial Number: " + wmi.GetPropertyValue("VolumeSerialNumber").ToString()
                + Environment.NewLine);
                sb.Append("Free Space: " + wmi.GetPropertyValue("FreeSpace").ToString() + "
                bytes free" + Environment.NewLine + Environment.NewLine);
            }
            catch {
                return sb.ToString();
            }
        }
        return sb.ToString();
    }
    

0 comments:

Post a Comment