diff --git a/settings.cpp b/settings.cpp
new file mode 100644
index 0000000..98254dd
--- /dev/null
+++ b/settings.cpp
@@ -0,0 +1,91 @@
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/log.hpp>
+#include "xyz/openbmc_project/Common/error.hpp"
+#include "settings.hpp"
+
+namespace settings
+{
+
+using namespace phosphor::logging;
+using namespace sdbusplus::xyz::openbmc_project::Common::Error;
+
+constexpr auto mapperService = "xyz.openbmc_project.ObjectMapper";
+constexpr auto mapperPath = "/xyz/openbmc_project/object_mapper";
+constexpr auto mapperIntf = "xyz.openbmc_project.ObjectMapper";
+
+Objects::Objects(sdbusplus::bus::bus& bus):
+    bus(bus)
+{
+    std::vector<std::string> settingsIntfs =
+        {autoRebootIntf, powerRestoreIntf};
+    auto depth = 0;
+
+    auto mapperCall = bus.new_method_call(mapperService,
+                                          mapperPath,
+                                          mapperIntf,
+                                          "GetSubTree");
+    mapperCall.append(root);
+    mapperCall.append(depth);
+    mapperCall.append(settingsIntfs);
+    auto response = bus.call(mapperCall);
+    if (response.is_method_error())
+    {
+        log<level::ERR>("Error in mapper GetSubTree");
+        elog<InternalFailure>();
+    }
+
+    using Interfaces = std::vector<Interface>;
+    using MapperResponse = std::map<Path, std::map<Service, Interfaces>>;
+    MapperResponse result;
+    response.read(result);
+    if (result.empty())
+    {
+        log<level::ERR>("Invalid response from mapper");
+        elog<InternalFailure>();
+    }
+
+    for (const auto& iter : result)
+    {
+        const Path& path = iter.first;
+        const Interface& interface = iter.second.begin()->second[0];
+
+        if (autoRebootIntf == interface)
+        {
+            autoReboot = path;
+        }
+        else if (powerRestoreIntf == interface)
+        {
+            powerRestorePolicy = path;
+        }
+    }
+}
+
+Service Objects::service(const Path& path, const Interface& interface) const
+{
+    using Interfaces = std::vector<Interface>;
+    auto mapperCall = bus.new_method_call(mapperService,
+                                          mapperPath,
+                                          mapperIntf,
+                                          "GetObject");
+    mapperCall.append(path);
+    mapperCall.append(Interfaces({interface}));
+
+    auto response = bus.call(mapperCall);
+    if (response.is_method_error())
+    {
+        log<level::ERR>("Error in mapper GetObject");
+        elog<InternalFailure>();
+    }
+
+    std::map<Service, Interfaces> result;
+    response.read(result);
+    if (result.empty())
+    {
+        log<level::ERR>("Invalid response from mapper");
+        elog<InternalFailure>();
+    }
+
+    return result.begin()->first;
+}
+
+} // namespace settings
diff --git a/settings.hpp b/settings.hpp
new file mode 100644
index 0000000..088628a
--- /dev/null
+++ b/settings.hpp
@@ -0,0 +1,57 @@
+#pragma once
+
+#include <string>
+#include <sdbusplus/bus.hpp>
+
+namespace settings
+{
+
+using Path = std::string;
+using Service = std::string;
+using Interface = std::string;
+
+constexpr auto root = "/";
+constexpr auto autoRebootIntf =
+    "xyz.openbmc_project.Control.Boot.RebootPolicy";
+constexpr auto powerRestoreIntf =
+    "xyz.openbmc_project.Control.Power.RestorePolicy";
+
+/** @class Objects
+ *  @brief Fetch paths of settings d-bus objects of interest, upon construction
+ */
+struct Objects
+{
+    public:
+        /** @brief Constructor - fetch settings objects
+         *
+         * @param[in] bus - The Dbus bus object
+         */
+        Objects(sdbusplus::bus::bus& bus);
+        Objects(const Objects&) = delete;
+        Objects& operator=(const Objects&) = delete;
+        Objects(Objects&&) = delete;
+        Objects& operator=(Objects&&) = delete;
+        ~Objects() = default;
+
+        /** @brief Fetch d-bus service, given a path and an interface. The
+         *         service can't be cached because mapper returns unique
+         *         service names.
+         *
+         * @param[in] path - The Dbus object
+         * @param[in] interface - The Dbus interface
+         *
+         * @return std::string - the dbus service name
+         */
+        Service service(const Path& path, const Interface& interface) const;
+
+        /** @brief host auto_reboot settings object */
+        Path autoReboot;
+
+        /** @brief host power_restore_policy settings object */
+        Path powerRestorePolicy;
+
+        /** @brief The Dbus bus object */
+        sdbusplus::bus::bus& bus;
+};
+
+} // namespace settings
