The Shulhan Aruch (Orah Haim 227:1) says that if one witnesses thunder or lightning, one should recite the blessing “Baruch Ata…Oseh Ma’ase Bereshit” (”Blessed art Thou…Who makes the works of Creation”) and that if one one wishes, one may also recite “Baruch Ata…Shekoho Ugvurato Male Olam” (“Blessed art Thou…Whose strength and might fill the universe”). The Mishna Berura (O.H. 227:5) clarifies that the custom nowadays is for the blessing of “Oseh Ma’ase Bereshit” to be recited specifically upon seeing lightning, while the blessing of “Shekoho” is recited when one hears thunder. Furthermore, Rabbi Eliezer Waldenberg (Tzitz Eliezer, vol. XII, § 21) states that regarding lightning, the blessing may be recited not only if one sees the bolt of lightning, but even flashes of lightning in the sky. The Mishna Berura’s position seems to be the accepted custom, but it should be noted that the blessings must be recited immediately after witnessing these phenomena.
Nevertheless, Rabbi Shalom Messas (Shemesh Umagen, vol. IV § 6), Rabbi Machlouf Abuhatzira (Yefe Sha’ah, § 23) and Rabbi Baruch Toledano (Kitzur Shulhan Aruch, § 113) all write that the custom in Morocco was to recite these blessings without Hashem’s Name. Other Sephardic rabbis, including the Ben Ish Hai (Parashat Ekev, § 16), concur. Rabbi Haim Pontremoli (Petah Hadevir, § 227) writes that one rationale is because the average person is not proficient in reciting the blessing within the allotted time after witnessing thunder or lightning and as such, it is preferable to not include Hashem’s Name. The Kaf Hahaim suggests that these blessings have the status of Reshut, or being voluntary, and therefore people did not normally take it upon themselves to recite it. Rabbi Shalom Messas, citing the Ramban, suggests that any Mitzvah which does not have an action does not require a blessing with Hashem’s Name. However, this is a questionable rationale since one does say Hashem’s Name upon seeing the Mediterranean Sea, etc., which also does not involve any actions.
Rabbi Ben Zion Abba Shaul (Or LeZion, vol. II, § 14:47) writes that, although the common custom is to not mention Hashem’s Name when reciting the blessings over thunder and lightning, there is a Halachic basis if one does recite it with Hashem’s Name.
(As a clarification, “without Hashem’s Name” refers to omitting the words “A-donai” and “E-lohenu Melech HaOlam” in a blessing).
Summary: The common custom is to recite the blessings over thunderand lightning without Hashem’s Name. However, one who recites these blessings with Hashem‘s Name has what to rely on.