Skip to content
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

New-M365DSCDeltaReport: Error $typeStaticMethods = [] | gm - ... Missing type name after '[' #4701

Closed
ThoVos-CH opened this issue May 22, 2024 · 5 comments

Comments

@ThoVos-CH
Copy link

ThoVos-CH commented May 22, 2024

Description of the issue

When creating a Delta Report of two configurations the commandlet New-M365DSCDeltaReport throws errors for every assignement in configuration files (Config below was for blueprint):

Invoke-Expression : In Zeile:1 Zeichen:63 + ... $typeStaticMethods = [] | gm - ... + ~ Der Typname nach "[" fehlt. In Zeile:4 Zeichen:46 + []::TryParse($subExpressi ... + ~ Der Typname nach "[" fehlt. In C:\Program Files\WindowsPowerShell\Modules\DSCParser\2.0.0.4\Modules\DSCParser.psm1:280 Zeichen:25 + ... Invoke-Expression -Command $scriptBlock | Out-N ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ParserError: (:) [Invoke-Expression], ParseException + FullyQualifiedErrorId : MissingTypename,Microsoft.PowerShell.Commands.InvokeExpressionCommand

You can reproduce it with a Policy which has assignments in it. The error will be thrown also on commandlet Assert-M365DSCBlueprint.
The only workaround for me was to remove all assignments from all configurations (source and destination).

To be sure i:
Removed Module
Reinstalled Module
Update-M365DSCModule
Update-M365DSCDependencies
Uninstall-M365DSCOutdatedDependencies

Microsoft 365 DSC Version

1.24.515.2

Which workloads are affected

Intune

The DSC configuration

# Generated with Microsoft365DSC version 1.24.424.1
# For additional information on how to use Microsoft365DSC, please visit https://aka.ms/M365DSC
param (
    [parameter()]
    [System.Management.Automation.PSCredential]
    $Credential
)

Configuration MyDefender
{
    param (
        [parameter()]
        [System.Management.Automation.PSCredential]
        $Credential
    )

    if ($null -eq $Credential)
    {
        <# Credentials #>
        $Credscredential = Get-Credential -Message "Credentials"

    }
    else
    {
        $CredsCredential = $Credential
    }

    $OrganizationName = $CredsCredential.UserName.Split('@')[1]

    Import-DscResource -ModuleName 'Microsoft365DSC' 

    Node localhost
    {
        IntuneAntivirusPolicyWindows10SettingCatalog "IntuneAntivirusPolicyWindows10SettingCatalog-NEW"
        {
            allowbehaviormonitoring = "1";
            allowcloudprotection    = "1";
            Assignments             = @(
                MSFT_DeviceManagementConfigurationPolicyAssignments{
                    deviceAndAppManagementAssignmentFilterType = 'none'
                    groupDisplayName = 'Some Group'
                    dataType = '#microsoft.graph.groupAssignmentTarget'
                    groupId = 'MYID'
                }
            ); ### L2| No Comment
            Description             = ""; ### L2| No Comment
            DisplayName             = "NEW"; ### L2| No Comment
            Ensure                  = "Present"; ### L2| No Comment
            realtimescandirection   = "0"; ### L2| No Comment
        }
}

MyDefender -ConfigurationData .\ConfigurationData.psd1 -Credential $Credential

Verbose logs showing the problem

No response

Environment Information + PowerShell Version

OsName               : Microsoft Windows 11 Pro
OsOperatingSystemSKU : 48
OsArchitecture       : 64-Bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 22621.1.amd64fre.ni_release.220506-1250
OsLanguage           : de-DE
OsMuiLanguages       : {de-DE}

Name                           Value
----                           -----
PSVersion                      5.1.22621.2506
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.2506
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
@ricmestre
Copy link
Contributor

See #4676

@ThoVos-CH
Copy link
Author

I updated the Version of M365DSC to 1.24.522.1 and forced an update of all Dependencies. Still no luck.

@FabienTschanz
Copy link
Contributor

@ThoVos-CH Did you already try the winrm quickconfig workaround from #4676? If yes, then can you please attach the output of $error (best in a .txt file) from the PowerShell session?

@ricmestre
Copy link
Contributor

ricmestre commented May 23, 2024

@FabienTschanz I just confirmed that enabling WinRM fixes this problem on my DevOps pipelines, although setting it up there involves a little bit more work than winrm quickconfig, but locally that's the way to go.

@ThoVos-CH
Copy link
Author

@FabienTschanz That did the trick. My Winrm Service was deactivated. After running winrm quickconfig, no errors.

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

No branches or pull requests

3 participants