To disconnect from MsolService in PowerShell, you can use the .Net ClearUserSessionState method.
This command is used to clear the user session state for the current Office 365 user. It will cause the user to be logged out of Office 365. This command will clear all of the variables and objects that are stored in the user session state.
[Microsoft.Online.Administration.Automation.ConnectMsolService] type is a PowerShell class that represents the Connect-MsolService cmdlet. The ClearUserSessionState() method is a method of this class that can be used to disconnect the user MSolService.
I hope the above article on how to disconnect from MSolService in PowerShell is helpful to you.
Once you run the above command, you will need to reconnect to Office 365 or Azure Active Directory using the Connect-MsolService cmdlet.
This command will prompt you to enter your Office 365 username and password to initiate a connection to Office 365.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.