Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

New-M365DSCDeltaReport fails with an error

Open yoinuma opened this issue 1 year ago • 4 comments

Description of the issue

After updating Microsoft365DSC to the latest version, running New-M365DSCDeltaReport results in an error. The command used is:

New-M365DSCDeltaReport -Source $newFile -Destination $oldFile -OutputPath "$rootPath\delta.html"

The error output is as follows:

Invoke-Expression : At line:1 char:67
+ ...                                        $typeStaticMethods = [] | gm - ...
+                                                                  ~
Missing type name after '['.
At line:4 char:50
+                                                 []::TryParse($subExpr ...
+                                                  ~
Missing type name after '['.
At C:\Program Files\WindowsPowerShell\Modules\DSCParser\2.0.0.16\Modules\DSCParser.psm1:382 char:29
+ ...                       Invoke-Expression -Command $scriptBlock | Out-N ...
+                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ParserError: (:) [Invoke-Expression], ParseException
    + FullyQualifiedErrorId : MissingTypename,Microsoft.PowerShell.Commands.InvokeExpressionCommand

Invoke-Expression : At line:1 char:67
+ ...                                        $typeStaticMethods = [] | gm - ...
+                                                                  ~
Missing type name after '['.
At line:4 char:50
+                                                 []::TryParse($subExpr ...
+                                                  ~
Missing type name after '['.
At C:\Program Files\WindowsPowerShell\Modules\DSCParser\2.0.0.16\Modules\DSCParser.psm1:382 char:29
+ ...                       Invoke-Expression -Command $scriptBlock | Out-N ...
+                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ParserError: (:) [Invoke-Expression], ParseException
    + FullyQualifiedErrorId : MissingTypename,Microsoft.PowerShell.Commands.InvokeExpressionCommand

This error repeats multiple times.

Microsoft 365 DSC Version

1.25.416.1

Which workloads are affected

SharePoint Online

The DSC configuration


Verbose logs showing the problem


Environment Information + PowerShell Version

PS C:\Users\yoinuma> Get-ComputerInfo -Property @(
>> 'OsName',
>> 'OsOperatingSystemSKU',
>> 'OSArchitecture',
>> 'WindowsVersion',
>> 'WindowsBuildLabEx',
>> 'OsLanguage',
>> 'OsMuiLanguages')


OsName               : Microsoft Windows 11 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 26100.1.amd64fre.ge_release.240331-1435
OsLanguage           : en-US
OsMuiLanguages       : {en-US}



PS C:\Users\yoinuma>
PS C:\Users\yoinuma> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.26100.1882
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.26100.1882
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

yoinuma avatar Apr 22 '25 06:04 yoinuma

@yoinuma Can you please try the command in an elevated PowerShell session? Also, can you share a minimal configuration for which it is failing for you?

FabienTschanz avatar Apr 22 '25 15:04 FabienTschanz

You may find your answer there: https://github.com/microsoft/Microsoft365DSC/issues/5064

Kierow avatar Apr 23 '25 06:04 Kierow

@FabienTschanz Yes, as shown in the screenshot below, PowerShell is being run with administrative privileges. Image

The configuration file being used is as follows.

param (
)

Configuration InitialM365TenantConfig
{
    param (
    )

    $OrganizationName = $ConfigurationData.NonNodeData.OrganizationName

    Import-DscResource -ModuleName 'Microsoft365DSC' -ModuleVersion '1.25.416.1'

    Node localhost
    {
        ODSettings "ODSettings"
        {
            ApplicationId                             = $ConfigurationData.NonNodeData.ApplicationId;
            BlockMacSync                              = $False;
            CertificateThumbprint                     = $ConfigurationData.NonNodeData.CertificateThumbprint;
            DisableReportProblemDialog                = $False;
            DomainGuids                               = @();
            Ensure                                    = "Present";
            ExcludedFileExtensions                    = @();
            IsSingleInstance                          = "Yes";
            NotificationsInOneDriveForBusinessEnabled = $True;
            ODBAccessRequests                         = "Unspecified";
            ODBMembersCanShare                        = "Unspecified";
            OneDriveForGuestsEnabled                  = $False;
            OneDriveStorageQuota                      = 1048576;
            OrphanedPersonalSitesRetentionPeriod      = 30;
            TenantId                                  = $OrganizationName;
            TenantRestrictionEnabled                  = $False;
        }
        SPOAccessControlSettings "SPOAccessControlSettings"
        {
            ApplicationId                 = $ConfigurationData.NonNodeData.ApplicationId;
            CertificateThumbprint         = $ConfigurationData.NonNodeData.CertificateThumbprint;
            ConditionalAccessPolicy       = "AllowFullAccess";
            DisallowInfectedFileDownload  = $False;
            DisplayStartASiteOption       = $True;
            EmailAttestationReAuthDays    = 30;
            EmailAttestationRequired      = $False;
            EnableRestrictedAccessControl = $False;
            Ensure                        = "Present";
            ExternalServicesEnabled       = $True;
            IPAddressAllowList            = "";
            IPAddressEnforcement          = $False;
            IPAddressWACTokenLifetime     = 15;
            IsSingleInstance              = "Yes";
            TenantId                      = $OrganizationName;
        }
        SPOBrowserIdleSignout "SPOBrowserIdleSignout"
        {
            ApplicationId         = $ConfigurationData.NonNodeData.ApplicationId;
            CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
            Enabled               = $False;
            IsSingleInstance      = "Yes";
            SignOutAfter          = "00:00:00";
            TenantId              = $OrganizationName;
            WarnAfter             = "00:00:00";
        }
        SPOHomeSite "SPOHomeSite"
        {
            ApplicationId         = $ConfigurationData.NonNodeData.ApplicationId;
            CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
            Ensure                = "Present";
            IsSingleInstance      = "Yes";
            TenantId              = $OrganizationName;
            Url                   = "https://mngenvmcap799152.sharepoint.com/sites/20241101_Site1";
        }
        SPOHubSite "SPOHubSite-https://$($OrganizationName.Split('.')[0]).sharepoint.com/sites/20241127_Site1"
        {
            AllowedToJoin         = @();
            ApplicationId         = $ConfigurationData.NonNodeData.ApplicationId;
            CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
            Ensure                = "Present";
            RequiresJoinApproval  = $False;
            SiteDesignId          = "00000000-0000-0000-0000-000000000000";
            TenantId              = $OrganizationName;
            Title                 = "20241127_Site1";
            Url                   = "https://$($OrganizationName.Split('.')[0]).sharepoint.com/sites/20241127_Site1";
        }
        SPORetentionLabelsSettings "SPORetentionLabelsSettings"
        {
            AdvancedRecordVersioningDisabled      = $False;
            AllowFilesWithKeepLabelToBeDeletedODB = $True;
            AllowFilesWithKeepLabelToBeDeletedSPO = $True;
            ApplicationId                         = $ConfigurationData.NonNodeData.ApplicationId;
            CertificateThumbprint                 = $ConfigurationData.NonNodeData.CertificateThumbprint;
            IsSingleInstance                      = "Yes";
            MetadataEditBlockingEnabled           = $False;
            TenantId                              = $OrganizationName;
        }
        SPOSharingSettings "SPOSharingSettings"
        {
            ApplicationId                            = $ConfigurationData.NonNodeData.ApplicationId;
            BccExternalSharingInvitations            = $False;
            CertificateThumbprint                    = $ConfigurationData.NonNodeData.CertificateThumbprint;
            DefaultLinkPermission                    = "Edit";
            DefaultSharingLinkType                   = "Internal";
            EnableGuestSignInAcceleration            = $False;
            Ensure                                   = "Present";
            ExternalUserExpirationRequired           = $False;
            ExternalUserExpireInDays                 = 60;
            FileAnonymousLinkType                    = "Edit";
            FolderAnonymousLinkType                  = "Edit";
            IsSingleInstance                         = "Yes";
            MySiteSharingCapability                  = "ExistingExternalUserSharingOnly";
            NotifyOwnersWhenItemsReshared            = $True;
            PreventExternalUsersFromResharing        = $False;
            ProvisionSharedWithEveryoneFolder        = $False;
            SharingCapability                        = "ExistingExternalUserSharingOnly";
            SharingDomainRestrictionMode             = "None";
            ShowAllUsersClaim                        = $False;
            ShowEveryoneClaim                        = $False;
            ShowEveryoneExceptExternalUsersClaim     = $False;
            ShowPeoplePickerSuggestionsForGuestUsers = $False;
            TenantId                                 = $OrganizationName;
        }
        SPOSiteScript "SPOSiteScript-DP"
        {
            ApplicationId         = $ConfigurationData.NonNodeData.ApplicationId;
            CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
            Content               = "{
  `"`$schema`": `"https://developer.microsoft.com/json-schemas/sp/site-design-script-actions.schema.json`",
  `"actions`": [
    {
      `"verb`": `"createSPList`",
      `"listName`": `"[[L_0001_listName]]`",
      `"templateType`": 101,
      `"color`": `"[[L_0001_color]]`",
      `"icon`": `"[[L_0001_icon]]`",
      `"addNavLink`": `"[[L_0001_addNavLink]]`",
      `"description`": `"[[L_0001_description]]`",
      `"identity`": `"L_0001`",
      `"subactions`": [
        {
          `"verb`": `"addSPFieldXml`",
          `"schemaXml`": `"<Field ID=\`"{08d89a66-4634-42b8-9d5a-0c27395a48b3}\`" Type=\`"Text\`" Name=\`"TriggerFlowInfo\`" DisplayName=\`"トリガー フローに関する情報\`" DisplaceOnUpgrade=\`"TRUE\`" Hidden=\`"TRUE\`" ReadOnlyEnforced=\`"FALSE\`" ReadOnly=\`"TRUE\`" Required=\`"FALSE\`" SourceID=\`"http://schemas.microsoft.com/sharepoint/v3\`" StaticName=\`"TriggerFlowInfo\`" />`"
        },
        {
          `"verb`": `"addSPFieldXml`",
          `"schemaXml`": `"<Field ID=\`"{321bc046-2178-49bd-893f-7aa4fd61d04e}\`" ReadOnly=\`"TRUE\`" Type=\`"Computed\`" Name=\`"PolicyDisabledUICapabilities\`" DisplaceOnUpgrade=\`"TRUE\`" DisplayName=\`"アクションはポリシーにより無効になっています。\`" Filterable=\`"FALSE\`" Sortable=\`"FALSE\`" Hidden=\`"TRUE\`" SourceID=\`"http://schemas.microsoft.com/sharepoint/v3\`" StaticName=\`"PolicyDisabledUICapabilities\`"><FieldRefs><FieldRef Name=\`"FSObjType\`" Key=\`"Primary\`" /><FieldRef Name=\`"ID\`" /></FieldRefs><DisplayPattern /></Field>`"
        },
        {
          `"verb`": `"addContentType`",
          `"name`": `"フォルダー`",
          `"id`": `"0x0120`"
        },
        {
          `"verb`": `"addSPView`",
          `"name`": `"すべてのドキュメント`",
          `"viewFields`": [
            `"DocIcon`",
            `"LinkFilename`",
            `"Modified`",
            `"Editor`",
            `"_DisplayName`"
          ],
          `"query`": `"<OrderBy><FieldRef Name=\`"FileLeafRef\`" /></OrderBy>`",
          `"rowLimit`": 30,
          `"isPaged`": true,
          `"makeDefault`": true,
          `"replaceViewFields`": true
        }

      ]
    },
    {
      `"verb`": `"importBusinessApps`",
      `"listName`": `"[[L_0001_listName]]`",
      `"solutionFileRelativePath`": `"solution.zip`"
    }
  ],
  `"bindings`": {
    `"L_0001_listName`": {
      `"source`": `"Input`",
      `"defaultValue`": `"ドキュメント`"
    },
    `"L_0001_icon`": {
      `"source`": `"Input`",
      `"defaultValue`": `"0`"
    },
    `"L_0001_description`": {
      `"source`": `"Input`",
      `"defaultValue`": `"`"
    },
    `"L_0001_color`": {
      `"source`": `"Input`",
      `"defaultValue`": `"0`"
    },
    `"L_0001_addNavLink`": {
      `"source`": `"Input`",
      `"defaultValue`": `"true`"
    }
  }
}
";
            Description           = "DP";
            Ensure                = "Present";
            Identity              = "b347d76c-bbc4-4c9b-81cb-26297b4fdd87";
            TenantId              = $OrganizationName;
            Title                 = "DP";
        }
        SPOTenantCdnEnabled "SPOTenantCdnEnabled-Public"
        {
            ApplicationId         = $ConfigurationData.NonNodeData.ApplicationId;
            CdnType               = "Public";
            CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
            Enable                = $True;
            TenantId              = $OrganizationName;
        }
        SPOTenantCdnEnabled "SPOTenantCdnEnabled-Private"
        {
            ApplicationId         = $ConfigurationData.NonNodeData.ApplicationId;
            CdnType               = "Private";
            CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
            Enable                = $False;
            TenantId              = $OrganizationName;
        }
        SPOTenantCdnPolicy "SPOTenantCdnPolicy-Public"
        {
            ApplicationId                        = $ConfigurationData.NonNodeData.ApplicationId;
            CDNType                              = "Public";
            CertificateThumbprint                = $ConfigurationData.NonNodeData.CertificateThumbprint;
            ExcludeRestrictedSiteClassifications = @();
            IncludeFileExtensions                = @("CSS","EOT","GIF","ICO","JPEG","JPG","JS","MAP","PNG","SVG","OTF","TTF","WOFF","WOFF2");
            TenantId                             = $OrganizationName;
        }
        SPOTenantCdnPolicy "SPOTenantCdnPolicy-Private"
        {
            ApplicationId                        = $ConfigurationData.NonNodeData.ApplicationId;
            CDNType                              = "Private";
            CertificateThumbprint                = $ConfigurationData.NonNodeData.CertificateThumbprint;
            ExcludeRestrictedSiteClassifications = @();
            IncludeFileExtensions                = @();
            TenantId                             = $OrganizationName;
        }
        SPOTenantSettings "SPOTenantSettings"
        {
            ApplicationId                                          = $ConfigurationData.NonNodeData.ApplicationId;
            ApplyAppEnforcedRestrictionsToAdHocRecipients          = $True;
            CertificateThumbprint                                  = $ConfigurationData.NonNodeData.CertificateThumbprint;
            CommentsOnSitePagesDisabled                            = $False;
            EnableAzureADB2BIntegration                            = $True;
            Ensure                                                 = "Present";
            ExemptNativeUsersFromTenantLevelRestricedAccessControl = $False;
            FilePickerExternalImageSearchEnabled                   = $True;
            HideDefaultThemes                                      = $False;
            IsSingleInstance                                       = "Yes";
            LegacyAuthProtocolsEnabled                             = $True;
            MarkNewFilesSensitiveByDefault                         = "AllowExternalSharing";
            MaxCompatibilityLevel                                  = "15";
            MinCompatibilityLevel                                  = "15";
            NotificationsInSharePointEnabled                       = $True;
            OfficeClientADALDisabled                               = $False;
            OwnerAnonymousNotification                             = $True;
            PublicCdnAllowedFileTypes                              = "CSS,EOT,GIF,ICO,JPEG,JPG,JS,MAP,PNG,SVG,TTF,WOFF";
            PublicCdnEnabled                                       = $False;
            SearchResolveExactEmailOrUPN                           = $False;
            SignInAccelerationDomain                               = "";
            SocialBarOnSitePagesDisabled                           = $False;
            TenantDefaultTimezone                                  = "(UTC+09:00) Osaka, Sapporo, Tokyo";
            TenantId                                               = $OrganizationName;
            UseFindPeopleInPeoplePicker                            = $False;
            UsePersistentCookiesForExplorerView                    = $False;
        }
        SPOTheme "SPOTheme-Custom Theme 01"
        {
            ApplicationId         = $ConfigurationData.NonNodeData.ApplicationId;
            CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
            Ensure                = "Present";
            IsInverted            = $False;
            Name                  = "Custom Theme 01";
            Palette               = @(
                MSFT_SPOThemePaletteProperty{
                    Property = "neutralQuaternaryAlt"
                    Value = "#d88888"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "themeLighterAlt"
                    Value = "#fdfef6"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "themeSecondary"
                    Value = "#cef23f"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "themePrimary"
                    Value = "#c9f027"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "bodyText"
                    Value = "#351c1c"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "disabledBackground"
                    Value = "#f29898"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "themeDarker"
                    Value = "#708615"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "themeDark"
                    Value = "#98b61d"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "themeLight"
                    Value = "#eefabb"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "neutralLighter"
                    Value = "#f29898"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "neutralLighterAlt"
                    Value = "#f69b9b"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "themeLighter"
                    Value = "#f6fddb"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "themeDarkAlt"
                    Value = "#b3d823"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "themeTertiary"
                    Value = "#ddf67a"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "primaryText"
                    Value = "#351c1c"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "bodyBackground"
                    Value = "#fca0a0"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "neutralSecondary"
                    Value = "#a48282"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "neutralQuaternary"
                    Value = "#ce8282"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "neutralLight"
                    Value = "#e89292"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "disabledText"
                    Value = "#c67d7d"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "neutralPrimaryAlt"
                    Value = "#8e6969"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "white"
                    Value = "#fca0a0"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "neutralDark"
                    Value = "#623e3e"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "primaryBackground"
                    Value = "#fca0a0"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "neutralPrimary"
                    Value = "#351c1c"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "neutralTertiaryAlt"
                    Value = "#c67d7d"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "neutralTertiary"
                    Value = "#bb9d9d"
                }
                MSFT_SPOThemePaletteProperty{
                    Property = "black"
                    Value = "#4c2c2c"
                }
            );
            TenantId              = $OrganizationName;
        }
    }
}

InitialM365TenantConfig -ConfigurationData .\ConfigurationData.psd1

yoinuma avatar Apr 23 '25 07:04 yoinuma

@yoinuma Please run winrm quickconfig or Enable-PSRemoting -Force -SkipNetworkProfileCheck and restart your session. It should work afterwards. I'll check why the error isn't caught earlier.

FabienTschanz avatar Apr 23 '25 19:04 FabienTschanz