Hello Syed Bukhari1,
Thank you for posting in Microsoft Community forum.
From the description above, I understand your question is related to run PS command about Exchange Online.
Since there are no engineers dedicated to Exchange Online in this forum. in order to be able to get a quick and effective handling of your issue, I recommend that you repost your question in the Q&A forum, where there will be a dedicated engineer to give you a professional and effective reply.
Here is the link for Q&A forum.
Questions - Microsoft Q&A
Click the "Ask a Question" button in the upper right corner to post your question and select "Microsoft Exchange Online Management" tag or "Microsoft Exchange Online" tag.
Other references:
Connect-ExchangeOnline (ExchangePowerShell) | Microsoft Learn
Connect to Exchange Online PowerShell | Microsoft Learn
I hope the information above is helpful.
If you have any question or concern, please feel free to let us know.
Best Regards,
Daisy Zhou