public string GetEnvironmentVariable(string ip, string username, string password, string envVarName) { string value = null; try { WMIHelper helper = new WMIHelper(ip, username, password); value = helper.GetEnvironmentVariable(envVarName); } catch (Exception ex) { throw new Exception(string.Format("Can not get the Environment Variable {0} of remote machine {1}. {2}", envVarName, Name, ex.Message)); } return(value); }