Skip to content

[Preview11]: Install-PSResource should not fail silently #465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
JustinGrote opened this issue Aug 17, 2021 · 5 comments
Closed
3 tasks done

[Preview11]: Install-PSResource should not fail silently #465

JustinGrote opened this issue Aug 17, 2021 · 5 comments

Comments

@JustinGrote
Copy link
Contributor

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

Install-psresource exchangeonlinemanagement

Expected behavior

Installs

Actual behavior

Fails silently (Should throw error)

Error details

install-psresource exchangeonlinemanagement -verbose

VERBOSE: All paths to search: 'C:\Users\JGrote\OneDrive - Allied Digital Services LLC\Documents\PowerShell\Modules'
VERBOSE: All paths to search: 'C:\Users\JGrote\OneDrive - Allied Digital Services LLC\Documents\PowerShell\Scripts'      
VERBOSE: Performing the operation "Install-PSResource" on target "package to install: 'exchangeonlinemanagement'".       
VERBOSE: Parameters passed in >>> Name: 'exchangeonlinemanagement'; Version: ''; Prerelease: 'False'; Repository: ''; AcceptLicense: 'False'; Quiet: 'False'; Reinstall: 'False'; TrustRepository: 'False'; NoClobber: 'False';
VERBOSE: Attempting to search for packages in 'PSGallery'
VERBOSE: Checking if untrusted repository should be used
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its Trusted value by running the Set-PSResourceRepository cmdlet. Are you sure you want to install the PSresource from 'PSGallery' ?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "No"): y
VERBOSE: Untrusted repository accepted as trusted source.
VERBOSE: Null Type provided, so add PSGalleryScripts repository
VERBOSE: Searching in repository PSGallery
VERBOSE: 2.0.5.0
VERBOSE: Null Type provided, so add PSGalleryScripts repository
VERBOSE: Searching in repository PSGallery
VERBOSE: Begin installing package: 'ExchangeOnlineManagement'
VERBOSE: Successfully able to download package from source to: 'C:\Users\JGrote\AppData\Local\Temp\8b59a87a-ae0d-43f8-8c4a-8634a7e657fc'
VERBOSE: Unable to successfully install package 'ExchangeOnlineManagement': 'Cannot generate a Windows PowerShell object for a ScriptBlock evaluating dynamic expressions. Dynamic expression: @{
RootModule = if($PSEdition -eq 'Core')
    {
        '.\netCore\ExchangeOnlineManagement.psm1'
    }
    else # Desktop
    {
        '.\netFramework\ExchangeOnlineManagement.psm1'
    }
FunctionsToExport = @('Connect-ExchangeOnline', 'Connect-IPPSSession', 'Disconnect-ExchangeOnline')
ModuleVersion = '2.0.5'
GUID = 'B5ECED50-AFA4-455B-847A-D8FB64140A22'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = '(c) 2021 Microsoft. All rights reserved.'
Description = 'This is a General Availability (GA) release of Exchange Online PowerShell V2 module.
Please check the documentation here - https://aka.ms/exops-docs.
For issues related to the module, contact Microsoft support.'
PowerShellVersion = '3.0'
CmdletsToExport = @('Get-EXOCasMailbox','Get-EXOMailbox','Get-EXOMailboxFolderPermission','Get-EXOMailboxFolderStatistics','Get-EXOMailboxPermission','Get-EXOMailboxStatistics','Get-EXOMobileDeviceStatistics','Get-EXORecipient','Get-EXORecipientPermission','Get-MyAnalyticsFeatureConfig','Get-UserBriefingConfig','Get-OwnerlessGroupPolicy','Get-VivaInsightsSettings','Set-MyAnalyticsFeatureConfig','Set-UserBriefingConfig','Set-OwnerlessGroupPolicy','Set-VivaInsightsSettings')       
FileList = if($PSEdition -eq 'Core')
{
    @('.\netCore\Microsoft.Exchange.Management.AdminApiProvider.dll',
        '.\netCore\Microsoft.Exchange.Management.ExoPowershellGalleryModule.dll',
        '.\netCore\Microsoft.Exchange.Management.RestApiClient.dll',
        '.\netCore\Microsoft.Identity.Client.dll',
        '.\netCore\Microsoft.IdentityModel.JsonWebTokens.dll',
        '.\netCore\Microsoft.IdentityModel.Logging.dll',
        '.\netCore\Microsoft.IdentityModel.Tokens.dll',
        '.\netCore\Microsoft.OData.Client.dll',
        '.\netCore\Microsoft.OData.Core.dll',
        '.\netCore\Microsoft.OData.Edm.dll',
        '.\netCore\Microsoft.Online.CSE.RestApiPowerShellModule.Instrumentation.dll',
        '.\netCore\Microsoft.Spatial.dll',
        '.\netCore\Microsoft.Win32.Registry.AccessControl.dll',
        '.\netCore\Newtonsoft.Json.dll',
        '.\netCore\System.Configuration.ConfigurationManager.dll',
        '.\netCore\System.Diagnostics.PerformanceCounter.dll',
        '.\netCore\System.IdentityModel.Tokens.Jwt.dll',
        '.\netCore\System.IO.Abstractions.dll',
        '.\netCore\System.Management.Automation.dll',
        '.\netCore\System.Runtime.CompilerServices.Unsafe.dll',
        '.\netCore\System.Security.Cryptography.Pkcs.dll',
        '.\netCore\System.Security.Cryptography.ProtectedData.dll',
        '.\netCore\System.Security.Permissions.dll',
        '.\netCore\System.Text.Encoding.CodePages.dll',
        '.\license.txt')
}
else # Desktop
{
    @('.\netFramework\Microsoft.Exchange.Management.AdminApiProvider.dll',
        '.\netFramework\Microsoft.Exchange.Management.ExoPowershellGalleryModule.dll',
        '.\netFramework\Microsoft.Exchange.Management.RestApiClient.dll',
        '.\netFramework\Microsoft.Identity.Client.dll',
        '.\netFramework\Microsoft.IdentityModel.Clients.ActiveDirectory.dll',
        '.\netFramework\Microsoft.OData.Client.dll',
        '.\netFramework\Microsoft.OData.Core.dll',
        '.\netFramework\Microsoft.OData.Edm.dll',
        '.\netFramework\Microsoft.Online.CSE.RestApiPowerShellModule.Instrumentation.dll',
        '.\netFramework\Microsoft.Spatial.dll',
        '.\netFramework\Newtonsoft.Json.dll',
        '.\netFramework\System.IO.Abstractions.dll',
        '.\netFramework\System.Management.Automation.dll',
        '.\license.txt')
}

PrivateData = @{
    PSData = @{
    # Tags applied to this module. These help with module discovery in online galleries.
    Tags = 'Exchange', 'ExchangeOnline', 'EXO', 'EXOV2', 'Mailbox', 'Management'
    ReleaseNotes = '
---------------------------------------------------------------------------------------------
Whats new in this release:

v2.0.5 :
    1. Manage ownerless Microsoft 365 groups through newly added cmdlets Get-OwnerlessGroupPolicy and Set-OwnerlessGroupPolicy.
    2. Add new cmdlets Get-VivaInsightsSettings and Set-VivaInsightsSettings for Global/ExchangeOnline/Teams administrators to control user access of Headspace features in Viva Insights.

---------------------------------------------------------------------------------------------
Previous Releases:

v2.0.4 :
    1. Manage EXO using Linux devices along with Browser based SSO Authentication for enhanced interactive management experience. No need to enter UserName and password everytime you run the PowerShell script.
    2. Manage EXO using Apple Macintosh devices. Supported versions of Apple MAC OS are Mojave, Catalina & Big Sur. Steps for installing PowerShell on MAC OS is documented here - https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-macos?view=powershell-7.1
    3. Real time policy & security enforcement in all user based authentication. Continuous Access Evaluation (CAE) has been enabled in EXO V2 Module. Read more about CAE here - https://techcommunity.microsoft.com/t5/azure-active-directory-identity/moving-towards-real-time-policy-and-security-enforcement/ba-p/1276933
    4. Use parameter InlineCredential to pass credentials of Non-MFA accounts on the go without the need of storing credentials in a variable
    5. More secure method to fetch access token using safe Reply URLs.
    6. Breaking change :- Change in cmdlet signature to configure MyAnalytics access for users in your tenant. Get/Set-UserAnalyticsConfig has been replaced by Get/Set-MyAnalyticsFeatureConfig Additionally, you can have more granular controls and configure access at feature level. For more steps read here - https://docs.microsoft.com/en-us/workplace-analytics/myanalytics/setup/configure-myanalytics

v2.0.3 :
    1. General availability of Certificate Based Authentication feature which enables using Modern Authentication in Unattended Scripting or background automation scenarios.
    2. Certificate Based Authentication accepts Certificate File directly from terminal thus enabling certificate files to be stored in Azure Key Vault and being fetched Just-In-Time for enhanced security. See parameter Certificate in Connect-ExchangeOnline.
    3. Connect with Exchange Online and Security Compliance Center simultaneously in a single PowerShell window.
    4. Ability to restrict the PowerShell cmdlets imported in a session using CommandName parameter, thus reducing memory footprint in case of high usage PowerShell applications.
    5. Get-ExoMailboxFolderPermission now supports ExternalDirectoryObjectID in the Identity parameter.
    6. Optimized latency of first V2 Cmdlet call. (Lab results show first call latency has been reduced from 8 seconds to ~1 seconds. Actual results will depend on result size and Tenant environment.)

v1.0.1 :
    1. This is the General Availability (GA) version of EXO PowerShell V2 Module. It is stable and ready for being used in production environments.
    2. Get-ExoMobileDeviceStatistics cmdlet now supports Identity parameter.
    3. Improved reliability of session auto-connect in certain cases where script was executing for ~50minutes and threw "Cmdlet not found" error due to a bug in auto-reconnect logic.
    4. Fixed data-type issues of two commonly used attributed "User" and "MailboxFolderUser" for easy migration of scripts.
    5. Enhanced support for filters as it now supports 4 more operators - endswith, contains, not and notlike support. Please check online documentation for attributes which are not supported in filter string.

---------------------------------------------------------------------------------------------
'
    LicenseUri='http://aka.ms/azps-license'
    }
}
}.'
VERBOSE: Attempting to delete 'C:\Users\JGrote\AppData\Local\Temp\8b59a87a-ae0d-43f8-8c4a-8634a7e657fc'
VERBOSE: Successfully deleted 'C:\Users\JGrote\AppData\Local\Temp\8b59a87a-ae0d-43f8-8c4a-8634a7e657fc'


### Environment data

```powershell
ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     3.0.11     beta       PowerShellGet                       {Find-PSResource, Get-InstalledPSResource, Get-PSR… 

Key   : PSVersion
Value : 7.1.4
Name  : PSVersion


Key   : PSEdition
Value : Core
Name  : PSEdition


Key   : GitCommitId
Value : 7.1.4
Name  : GitCommitId


Key   : OS
Value : Microsoft Windows 10.0.22000
Name  : OS


Key   : Platform
Value : Win32NT
Name  : Platform


Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name  : PSCompatibleVersions


Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion


Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion


Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Visuals

No response

@anamnavi anamnavi changed the title [Preview11] [Preview11]: Install-PSResource should not fail silently Aug 17, 2021
@anamnavi
Copy link
Member

Triage what's happening with code script block in psm1 file

@et1975
Copy link

et1975 commented Nov 3, 2021

Any update on this?

@StevenBucher98
Copy link
Collaborator

@et1975 this is being worked on currently, we hope to get this fixed for the next release.

@anamnavi
Copy link
Member

anamnavi commented Nov 5, 2021

This issue is resolved by PR #525 and will be present in the next release (3.0.12). This will ensure that Install doesn't fail silently or require the user to use Verbose to see the error, but rather writes the error. Running the command @JustinGrote is running will now write an error out.

@anamnavi anamnavi closed this as completed Nov 5, 2021
@anamnavi
Copy link
Member

anamnavi commented Nov 5, 2021

I've opened this issue: https://github.com/PowerShell/PowerShellGet/issues/533
for the parsing failing for this module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants