'Connect-MsolService' is not recognized as the name of a cmdlet

后端 未结 4 1180
鱼传尺愫
鱼传尺愫 2021-02-09 01:13
        PSCommand commandToRun = new PSCommand();
        commandToRun.AddCommand(\"Connect-MsolService\");
        commandToRun.AddParameter(\"Credential\", new PSCrede         


        
相关标签:
4条回答
  • 2021-02-09 01:42

    I had to do this in that order:

    Install-Module MSOnline
    Install-Module AzureAD
    Import-Module AzureAD
    
    0 讨论(0)
  • 2021-02-09 01:43

    All links to the Azure Active Directory Connection page now seem to be invalid.

    I had an older version of Azure AD installed too, this is what worked for me. Install this.

    Run these in an elevated PS session:

    uninstall-module AzureAD  # this may or may not be needed
    install-module AzureAD
    install-module AzureADPreview
    install-module MSOnline
    

    I was then able to log in and run what I needed.

    0 讨论(0)
  • 2021-02-09 01:53

    This issue can occur if the Azure Active Directory Module for Windows PowerShell isn't loaded correctly.

    To resolve this issue, follow these steps.
    1.Install the Azure Active Directory Module for Windows PowerShell on the computer (if it isn't already installed). To install the Azure Active Directory Module for Windows PowerShell, go to the following Microsoft website:
    Manage Azure AD using Windows PowerShell

    2.If the MSOnline module isn't present, use Windows PowerShell to import the MSOnline module.

    Import-Module MSOnline 
    

    After it complete, we can use this command to check it.

    PS C:\Users> Get-Module -ListAvailable -Name MSOnline*
    
    
        Directory: C:\windows\system32\WindowsPowerShell\v1.0\Modules
    
    
    ModuleType Version    Name                                ExportedCommands
    ---------- -------    ----                                ----------------
    Manifest   1.1.166.0  MSOnline                            {Get-MsolDevice, Remove-MsolDevice, Enable-MsolDevice, Disable-MsolDevice...}
    Manifest   1.1.166.0  MSOnlineExtended                    {Get-MsolDevice, Remove-MsolDevice, Enable-MsolDevice, Disable-MsolDevice...}
    

    More information about this issue, please refer to it.


    Update:

    We should import azure AD powershell to VS 2015, we can add tool and select Azure AD powershell.

    0 讨论(0)
  • 2021-02-09 01:58

    Following worked for me:

    1. Uninstall the previously installed ‘Microsoft Online Service Sign-in Assistant’ and ‘Windows Azure Active Directory Module for Windows PowerShell’.
    2. Install 64-bit versions of ‘Microsoft Online Service Sign-in Assistant’ and ‘Windows Azure Active Directory Module for Windows PowerShell’. https://littletalk.wordpress.com/2013/09/23/install-and-configure-the-office-365-powershell-cmdlets/

    If you get the following error In order to install Windows Azure Active Directory Module for Windows PowerShell, you must have Microsoft Online Services Sign-In Assistant version 7.0 or greater installed on this computer, then install the Microsoft Online Services Sign-In Assistant for IT Professionals BETA: http://www.microsoft.com/en-us/download/details.aspx?id=39267

    1. Copy the folders called MSOnline and MSOnline Extended from the source

    C:\Windows\System32\WindowsPowerShell\v1.0\Modules\

    to the folder

    C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Modules\

    https://stackoverflow.com/a/16018733/5810078.

    (But I have actually copied all the possible files from

    C:\Windows\System32\WindowsPowerShell\v1.0\

    to

    C:\Windows\SysWOW64\WindowsPowerShell\v1.0\

    (For copying you need to alter the security permissions of that folder))

    0 讨论(0)
提交回复
热议问题