soteria-security / 365Inspect

A PowerShell script that automates the security assessment of Microsoft 365 environments.
https://soteria.io/solutions/soteria-inspect/
MIT License
561 stars 105 forks source link

Module Loading Errors #62

Closed clifpi closed 1 year ago

clifpi commented 1 year ago

Hi, I installed all the modules and loaded them prior to running the script. However, it looks like it is trying to load them but gettings this result: Environment is 7.3.4 [+] PowerShellGet is installed. Importing PowerShellGet Get-Package: No match was found for the specified search criteria and module names 'ExchangeOnlineManagement'. InvalidArgument: C:\temp\365Inspect\365Inspect.ps1:192 Line | 192 | $installedVersion = [Version](((Get-InstalledModule -Name $mo … | ~~~~~~~~~~~~~ | Cannot convert value "" to type "System.Version". Error: "Version string portion was too short or too long. (Parameter 'input')" Get-Package: No match was found for the specified search criteria and module names 'ExchangeOnlineManagement'.

ExchangeOnlineManagement is not installed. The module may be installed by running "Install-Module -Name ExchangeOnlineManagement -AllowPrerelease -AllowClobber -Force -MinimumVersion System.Collections.Hashtable" in an elevated PowerShell window. Would you like to attempt installation now? (Y|N): Y Install-Module: Cannot process argument transformation on parameter 'MinimumVersion'. Cannot create object of type "System.Version". The MinimumVersion property was not found for the System.Version object. The available property is: [Major ] , [Minor ] , [Build ] , [Revision ] , [MajorRevision ] , [MinorRevision ] Get-Package: No match was found for the specified search criteria and module names 'Microsoft.Graph'. InvalidArgument: C:\temp\365Inspect\365Inspect.ps1:192 Line | 192 | $installedVersion = [Version](((Get-InstalledModule -Name $mo … | ~~~~~~~~~~~~~ | Cannot convert value "" to type "System.Version". Error: "Version string portion was too short or too long. (Parameter 'input')" Get-Package: No match was found for the specified search criteria and module names 'Microsoft.Graph'.

Microsoft.Graph is not installed. The module may be installed by running "Install-Module -Name Microsoft.Graph -AllowPrerelease -AllowClobber -Force -MinimumVersion System.Collections.Hashtable" in an elevated PowerShell window. Would you like to attempt installation now? (Y|N): Y Install-Module: Cannot process argument transformation on parameter 'MinimumVersion'. Cannot create object of type "System.Version". The MinimumVersion property was not found for the System.Version object. The available property is: [Major ] , [Minor ] , [Build ] , [Revision ] , [MajorRevision ] , [MinorRevision ] Get-Package: No match was found for the specified search criteria and module names 'Microsoft.Online.SharePoint.PowerShell'. InvalidArgument: C:\temp\365Inspect\365Inspect.ps1:192 Line | 192 | $installedVersion = [Version](((Get-InstalledModule -Name $mo … | ~~~~~~~~~~~~~ | Cannot convert value "" to type "System.Version". Error: "Version string portion was too short or too long. (Parameter 'input')" Get-Package: No match was found for the specified search criteria and module names 'Microsoft.Online.SharePoint.PowerShell'.

Microsoft.Online.SharePoint.PowerShell is not installed. The module may be installed by running "Install-Module -Name Microsoft.Online.SharePoint.PowerShell -AllowPrerelease -AllowClobber -Force -MinimumVersion System.Collections.Hashtable" in an elevated PowerShell window. Would you like to attempt installation now? (Y|N): Y Install-Module: Cannot process argument transformation on parameter 'MinimumVersion'. Cannot create object of type "System.Version". The MinimumVersion property was not found for the System.Version object. The available property is: [Major ] , [Minor ] , [Build ] , [Revision ] , [MajorRevision ] , [MinorRevision ] Get-Package: No match was found for the specified search criteria and module names 'MicrosoftTeams'. InvalidArgument: C:\temp\365Inspect\365Inspect.ps1:192 Line | 192 | $installedVersion = [Version](((Get-InstalledModule -Name $mo … | ~~~~~~~~~~~~~ | Cannot convert value "" to type "System.Version". Error: "Version string portion was too short or too long. (Parameter 'input')" Get-Package: No match was found for the specified search criteria and module names 'MicrosoftTeams'.

MicrosoftTeams is not installed. The module may be installed by running "Install-Module -Name MicrosoftTeams -AllowPrerelease -AllowClobber -Force -MinimumVersion System.Collections.Hashtable" in an elevated PowerShell window. Would you like to attempt installation now? (Y|N): Y Install-Module: Cannot process argument transformation on parameter 'MinimumVersion'. Cannot create object of type "System.Version". The MinimumVersion property was not found for the System.Version object. The available property is: [Major ] , [Minor ] , [Build ] , [Revision ] , [MajorRevision ] , [MinorRevision ] Connecting to Microsoft Graph Welcome To Microsoft Graph! Get-MgOrganization_List: C:\temp\365Inspect\365Inspect.ps1:71 Line | 71 | $global:orgInfo = ((Get-MgOrganization).VerifiedDomains | … | ~~~~~~~~~~~~~ | Method not found: 'System.Net.Http.HttpClient | Microsoft.Graph.PowerShell.Authentication.Helpers.HttpHelpers.GetGraphHttpClient(System.Management.Automation.InvocationInfo, | Microsoft.Graph.PowerShell.Authentication.IAuthContext)'. Connecting to Microsoft Graph Failed. Write-Error: C:\temp\365Inspect\365Inspect.ps1:292 Line | 292 | Connect-Services | ~~~~ | Cannot index into a null array.

ThoughtContagion commented 1 year ago

If you run Get-Module -ListAvailable do you see those modules listed as installed in PS 7?

clifpi commented 1 year ago

It looks like they are all loading except Microsoft Teams et-Module -ListAvailable -Name MicrosoftTeams

Directory: C:\Users\Documents\PowerShell\Modules

ModuleType Version PreRelease Name PSEdition ExportedCommands


Script 4.4.1 MicrosoftTeams Core,Desk {Add-TeamChannelUser, Add-TeamUser, Con…

PS C:\temp\365Inspect> Update-Module MicrosoftTeams Write-Error: Module 'MicrosoftTeams' was not updated because no valid module was found in the module directory. Verify that the module is located in the folder specified by $env:PSModulePath.

clifpi commented 1 year ago

he module may be installed by running "Install-Module -Name MicrosoftTeams -AllowPrerelease -AllowClobber -Force -MinimumVersion System.Collections.Hashtable" in an elevated PowerShell window. Would you like to attempt installation now? (Y|N): Y Install-Module: Cannot process argument transformation on parameter 'MinimumVersion'. Cannot create object of type "System.Version". The MinimumVersion property was not found for the System.Version object. The available property is: [Major ] , [Minor ] , [Build ] , [Revision ] , [MajorRevision ] , [MinorRevision ] Connecting to Microsoft Graph Welcome To Microsoft Graph! Get-MgOrganization_List: C:\365Inspect.ps1:71 Line | 71 | $global:orgInfo = ((Get-MgOrganization).VerifiedDomains | … | ~~~~~~~~~~~~~ | Method not found: 'System.Net.Http.HttpClient | Microsoft.Graph.PowerShell.Authentication.Helpers.HttpHelpers.GetGraphHttpClient(System.Management.Automation.InvocationInfo, Microsoft.Graph.PowerShell.Authentication.IAuthContext)'. Connecting to Microsoft Graph Failed. Write-Error: C:\365Inspect.ps1:292 Line | 292 | Connect-Services | ~~~~ | Cannot index into a null array. PS C:\365Inspect-main>

clifpi commented 1 year ago

Teams is listed in the module, the script doesn't see it Script 4.4.1 MicrosoftTeams Core,Desk {Add-TeamChannelUser, Add-TeamUser, Con…

ThoughtContagion commented 1 year ago

We are unable to replicate this issue. Could you run the following commands and paste the results so we may configure a test environment to see if we can reproduce your experience? (Get-ComputerInfo).OsName $PSVersionTable $modules = ("ExchangeOnlineManagement","Microsoft.Graph","Microsoft.Online.SharePoint.PowerShell","MicrosoftTeams") Foreach ($module in $modules){ Get-InstalledModule -Name $module | Select Name, Version }

ThoughtContagion commented 1 year ago

Closing as inactive. Feel free to re-open if you continue to experience this issue and can provide additional information.