Install-Module Microsoft Graph PowerShell Module

Glenn Maxwell 12,621 Reputation points
2022-09-06T05:47:58.32+00:00

Hi All

I am getting below error installing Microsoft.Graph powershell module please guide me

PS C:\Windows\system32> Install-Module Microsoft.Graph -Scope AllUsers
PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'Microsoft.Graph'. Try Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21

  • ... $null = PackageManagement\Install-Package @PSBoundParameters
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
  • FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

PS C:\Windows\system32> Get-PSRepository
WARNING: Unable to find module repositories.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,518 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,628 questions
{count} vote

Accepted answer
  1. Vasil Michev 117.1K Reputation points MVP
    2022-09-06T06:38:22.127+00:00

    You need to add the PowerShell Gallery repository first:

    Register-PSRepository -Default  
    
    2 people found this answer helpful.

4 additional answers

Sort by: Most helpful
  1. Glenn Maxwell 12,621 Reputation points
    2022-09-06T14:49:34.207+00:00

    The below fixed it

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    Unregister-PSRepository -Name PSGallery
    Register-PSRepository -Default

    4 people found this answer helpful.

  2. Alf Løkken 5 Reputation points
    2024-10-24T05:36:16.1833333+00:00

    For anyone whom finds this in the future, you need to add the "-AllowPrerelease" flag.
    User's image

    "Acquiring prerelease packages requires adding -AllowPrerelease flag to the PowerShellGet commands Find-Module, Install-Module, Update-Module, and Save-Module. If the flag is not specified, prerelease packages will not be shown."
    https://learn.microsoft.com/en-us/powershell/gallery/concepts/module-prerelease-support?view=powershellget-3.x

    1 person found this answer helpful.
    0 comments No comments

  3. Glenn Maxwell 12,621 Reputation points
    2022-09-06T10:27:58.407+00:00

    238176-er.jpg

    0 comments No comments

  4. Glenn Maxwell 12,621 Reputation points
    2022-09-06T14:24:06+00:00

    The below should fix it, let me try it

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

    Unregister-PSRepository -Name PSGallery
    Register-PSRepository -Default


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.