Table of Contents
“Enter your password credentials” is a lie..
Do you dislike it as much as me that after some time you get the error message that you have to re-enter your credentials?
“Creating a new session for implicit remoting or ‘Cmdlet ’command”

It says: “Enter your password credentials“, but that’s just a lie.
Then enter your password, run your script or cmdlet again, and then asks for your credentials again.
Only when you restart PowerShell, or Visual Studio Code, can you log in again and you can call commands in Exchange again.
Well, below I have a solution or workaround for you, and you no longer need to restart your code editor.
Let’s fix ‘Creating a new session for implicit remoting of “Cmdlet” command’.
Okay, logging in again this way won’t work.
If you want to know why not, you can go to paragraph “But why -AllowClobber?“.
You have probably also tried to log in again via the cmdlets that you have saved to log on Exchange Online, unfortunately this doesn’t work either.
This is because a parameter is missing when importing your session.
Add the following to your Import-PSSession.
Import-PSSession $Session -AllowClobber
If you still use basic authentication, your credentials are still stored in $Cred365 = Get-Credential.
With the Exchange Online modern authentication module you unfortunately have to log in again to Exchange Online, but you do not have to restart PowerShell_ISE or Visual Studio Code.
For basic authentication your code would be:
$cred365 = get-credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred365 -Authentication Basic -AllowRedirection
Import-PSSession $Session -AllowClobber
And for the ExO modern authentication you can use:
Import-Module $((Get-ChildItem -Path $($env:LOCALAPPDATA + "\Apps\2.0\") -Filter Microsoft.Exchange.Management.ExoPowershellModule.dll -Recurse ).FullName | ? { $_ -notmatch "_none_" } | select -First 1)
$EXOSession = New-ExoPSSession -UserPrincipalName $username
Import-PSSession $EXOSession -AllowClobber
But why -AllowClobber?
If we go to Import-PSSession on Microsoft Docs, the following is stated at –AllowClobber:
Indicates that this cmdlet imports the specified commands, even if they have the same names as commands in the current session.
If you import a command with the same name as a command in the current session, the imported command hides or replaces the original commands. For more information, see about_Command_Precedence.
By default, Import-PSSession does not import commands that have the same name as commands in the current session.
This means that commands that have already been imported through your old session will not be re-imported.
Because this is on a remote server, and your new connection goes to another server, the commands that have already been imported by your old session, still try to go to the old remote server and you are constantly asked if you can enter your credentials.
With -AllowClobber you overwrite those commands.
hello,
Can you please tell me what is the solution when we are getting the same error for Connect-IPPSSession with MFA. after few runs I am getting “Creating a new Remote PowerShell session using Modern Authentication for implicit remoting powershell”. Please help on this. I am using Connect-IPPSSession and to disconnect exchange online.