PS: O365 cmdlet issue.



  • Found my old thread on this; but it's not working

    I have a number of password to reset. I have the CSV file, but the cmdlet fails.

    Set-MsolUserPassword : The term 'Set-MsolUserPassword' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
    verify that the path is correct and try again.
    At line:1 char:37
    + Import-CSV C:\ssi-ps-pswdrst.csv |%{Set-MsolUserPassword -userPrincip ...
    +                                     ~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Set-MsolUserPassword:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    

    The MsoluserPassword cmdlet - nothing on MS support seems to get it to connect...



  • Import failed:

    >$ Import-Module MSOnline
    Import-Module : The specified module 'MSOnline' was not loaded because no valid module file was found in any module directory.
    At line:1 char:1
    + Import-Module MSOnline
    + ~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ResourceUnavailable: (MSOnline:String) [Import-Module], FileNotFoundException
        + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
    


  • We needed this, which is literally never mentioned anywhere, ever.

    Install-Module -Name MSOnline


  • You need that module for any connection to Office 365...



  • For my record later:

    Install-Module -Name MSOnline <added>

    Set-ExecutionPolicy RemoteSigned
    
    $UserCredential = Get-Credential
    
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
    
    Import-PSSession $Session
    
    Connect-MsolService -Credential $credential
    

    Now,.. did I get them in the right order...



  • @dbeato said in PS: O365 cmdlet issue.:

    You need that module for any connection to Office 365...

    Yes, but no documents anywhere mention installing it with that command. Never. The closest that we could fine was a document telling us to get AzureAD instead, which turns out to not work here.



  • @gjacobse said in PS: O365 cmdlet issue.:

    For my record later:

    Set-ExecutionPolicy RemoteSigned

    $UserCredential = Get-Credential

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

    Import-PSSession $Session

    Connect-MsolService -Credential $credential

    Now,.. did I get them in the right order...

    No, the session after connect and then Import.



  • @gjacobse said in PS: O365 cmdlet issue.:

    For my record later:

    /wtb codeblock around that... ```



  • @scottalanmiller said in PS: O365 cmdlet issue.:

    @dbeato said in PS: O365 cmdlet issue.:

    You need that module for any connection to Office 365...

    Yes, but no documents anywhere mention installing it with that command. Never. The closest that we could fine was a document telling us to get AzureAD instead, which turns out to not work here.

    The only time I used powershell to modify O365 was to shutdown Clutter. Those instructions had that, as it worked. Never looked for any other things though. so no idea.



  • @jaredbusch said in PS: O365 cmdlet issue.:

    @scottalanmiller said in PS: O365 cmdlet issue.:

    @dbeato said in PS: O365 cmdlet issue.:

    You need that module for any connection to Office 365...

    Yes, but no documents anywhere mention installing it with that command. Never. The closest that we could fine was a document telling us to get AzureAD instead, which turns out to not work here.

    The only time I used powershell to modify O365 was to shutdown Clutter. Those instructions had that, as it worked. Never looked for any other things though. so no idea.

    Used to work for us, too. But something has changed, from what we can tell. Our own notes and links we used to use aren't the same any more.



  • @jaredbusch said in PS: O365 cmdlet issue.:

    @gjacobse said in PS: O365 cmdlet issue.:

    For my record later:

    /wtb codeblock around that... ```

    I fixed it.