WASHINGTON — Silicon Valley is fuming about President Trump’s stance on climate and immigration, but top technology executives still made a pilgrimage to the White House on Monday to discuss a potential upgrade of government technology.

Timothy D. Cook of Apple, Jeff Bezos of Amazon, Satya Nadella of Microsoft and Eric Schmidt of Alphabet were among 18 tech executives and investors — many of whom have criticized the Trump administration — who attended the four-hour afternoon session to discuss cloud computing and procurement systems run by government agencies.

For many, it was the second group meeting with Mr. Trump since the election — and another demonstration of the administration’s ability to summon top business executives, even amid controversy.

“Government needs to catch up with the technology revolution,” said Mr. Trump, who strolled in at the end of the meeting to greet the tech titans. “We’re going to change that with the help of great American businesses like the people assembled.”

He later said, drawing laughter, “We have approximately $3.5 trillion of market value in this room — but that’s almost the exact number that we’ve created since my election.”

Few technology specialists from the White House attended. The administration has not filled several major science and technology positions. But the business and economics team closest to the president attended, including Gary D. Cohn, director of the National Economic Council, and Dina Powell, senior counselor for economic initiatives.

The event was organized by Jared Kushner, special adviser to the president and Mr. Trump’s son-in-law, and Chris Liddell, the White House director of strategic initiatives and former chief financial officer of Microsoft. Mr. Kushner’s Office of American Innovation brought together the executives for 10 workshops on topics such as cybersecurity, analytics and using technology to better connect people to government services.

Mr. Kushner opened the event in the White House Indian Peace Treaty room by emphasizing the potential of the companies to improve the government’s outdated and inefficient technology systems.

“Together we will unleash the creativity of the private sector to provide citizen services in a way that has never happened before,” he said.

The opportunity for Silicon Valley is enormous. The federal government spends $80 billion a year on information technology, much of it used to maintain outdated technology such as data systems that are decades old and storage that includes floppy disks used at the Defense Department. Federal agencies maintain 6,100 data centers that could be consolidated and moved to the cloud.

The meeting occurred as tech company stocks roared back after declining in the last two weeks, pushing the stock market to records on Monday. Apple and Alphabet, the parent of Google, were among the top gainers after three consecutive sessions of declines.

The tech industry has walked a delicate line in its engagement with the Trump administration. Some tech workers and customers have called on industry leaders to withdraw from positions as official advisers to the president. Uber’s chief executive, Travis Kalanick, resigned as a White House adviser after protests by employees and users. Elon Musk, chief executive of SpaceX and Tesla, quit the White House business advisory council after the administration withdrew the United States from the Paris climate accord.

Mr. Musk did not attend the meeting Monday. Mark Zuckerberg, the chief executive of Facebook, was invited but declined because of a scheduling conflict, the company said.

The meeting occurred only weeks after tech executives, including Mr. Musk and Mr. Cook, publicly criticized the withdrawal from the Paris accord. But senior administration officials said they had not encountered any reluctance to participate in the event and had a waiting list for people who wanted to attend.

“This is a double-edged sword for the tech C.E.O.s because they don’t want to be window dressing and used for photo ops,” said Jeffrey Sonnenfeld, a professor and associate dean at the Yale School of Management. “But on the other side, this is the most business-friendly administration since Eisenhower and is much more open than any administration to influence on the spot.”

Administration officials said that the chief executives had done their homework and were engaged in the workshops and discussions.

“I don’t think there was any one big suggestion,” Mr. Liddell said in an interview. “But there was a large number of small suggestions, all of which are interesting for us to follow up.”

Several tech executives had a chance to address Mr. Trump in a round-table discussion at the end of the day.

Mr. Bezos encouraged the president to use commercial technology whenever possible. Amazon’s booming cloud services business has become a contractor to the government. The Amazon founder also emphasized the need to retrain workers and said it was “impossible to overstate” the importance of artificial intelligence.

Peter Thiel, an early Trump supporter and tech investor, praised the president.

“Your administration is doing very well,” he said.

Brad Smith, Microsoft’s president, said on Twitter that the company made the case “for why healthy high-skilled immigration and investments in education are good for the country.”

Two people who were briefed on the tech meeting later said Mr. Trump also voiced support for “comprehensive” immigration reform, a term that was used during the Obama administration to generally describe a pathway to citizenship for undocumented immigrants in the United States.

The president made the promise, the two people said, after being told by Mr. Cook that tech employees may worry they are being targeted amid confusion over the administration’s immigration policy. It was unclear exactly what the president meant, or if he was using the term to mean something else. White House press aides did not respond to a request for comment on Monday night, and a spokesman for Apple declined to comment.

Mr. Trump in February told a group of network anchors that he was considering pushing some form of comprehensive immigration reform package. But he never said it publicly or produced a proposal, and has taken a hard line against it immigration in speeches and public comments.

Maggie Haberman contributed reporting from Washington, Vindu Goel from San Francisco, and Nick Wingfield from Seattle.

A version of this article appears in print on , on Page B5 of the New York edition with the headline: Silicon Valley Chiefs Attend White House Forum on Government Tech. Order Reprints | Today’s Paper | Subscribe