Unable to log into PowerShell

MTHS DATA Administrator 0 Reputation points
2023-08-06T20:25:50.9566667+00:00

I have been using the same script for the last 20 years. Recently it stopped working and says that the login does not work (it does work) Does anyone know if something here has changed? I am thinking that the website might be different but don't know where to even start. This is the login prompt for Office 365 account. Thank you for your help

$LiveCred = Get-Credential 

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection 

Import-PSSession $Session   

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,908 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. S.Sengupta 22,821 Reputation points MVP
    2023-08-07T00:45:04.82+00:00

    you can use the Connect-MsolService cmdlet. This cmdlet allows you to connect to the Microsoft Online Services, which includes Office 365.

    Kindly go through the following Microsoft reference article:

    Connect to Microsoft 365 with PowerShell

    0 comments No comments

  2. Ian Xue-MSFT 41,691 Reputation points Microsoft External Staff
    2023-08-07T04:32:21.4+00:00

    Hi,

    It is recommended to migrate to Microsoft Graph PowerShell. You can use Connect-MgGraph to connect to Microsoft Graph.

    https://learn.microsoft.com/en-us/powershell/microsoftgraph/authentication-commands?view=graph-powershell-1.0

    Best Regards,

    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.