ActiveDirectoryManagementFramework / ADMF

Module for managing configuration contexts for Active Directory
MIT License
26 stars 2 forks source link

Broken WMI filter #58

Open dbeugger opened 2 months ago

dbeugger commented 2 months ago
PS>  Get-Module admf | ft Name, Version
Name Version
---- -------
ADMF 1.13.100

I created ADMF psd1 file for the WMI filter Amdf-Test-1Q

@{
    Name        = 'Admf-Test-1Q'
    Description = 'Test for  ADMF, one query'
    Query       = @('SELECT * FROM Win32_OperatingSystem WHERE ProductType = 1')
    # Namespace = 'root\CIMv2'
    Author      = 'Daniel Beugger'
    CreatedOn   = '2024-06-24'
}

When I create the filter with Invoke-AdmfDomain the first time, it shows no error. But a Test-AdmfDomain will show a difference. The execution of Invoke-AdmfDomain will show the following error WARNING: [20:03:18][Invoke-DMWmiFilter] Invalid input: 2! This command only accepts output objects from Test-DMWmiFilter

When I start gpmc.msc and edit the filter, no query is displayed. I can add the query by hand. Bit when i try to save the filter I get following error: Error text not available. Error code = 80041008

I created the same WMI filter by hand with the same query. After SELECT I entered two blanks. Test-AdmfDomain shows a difference. Invoke-AdmfDomain changes the filter without an error. But again, the filter is corrupt

When I use a filter Admf-Test-2Q with two query's the creation works as expected

@{
    Name        = 'Admf-Test-2Q'
    Description = 'Test for ADMF, two querys'
    Query       = @(
        'SELECT * FROM Win32_OperatingSystem WHERE ProductType =  1'
        'SELECT * FROM Win32_OperatingSystem'
        )
    # Namespace = 'root\CIMv2'
    Author      = 'Daniel Beugger'
    CreatedOn   = '2024-06-24'
}

When the query's has changed the Invoke-AdmfDomain will fix it, but the same error as above will be shown: WARNING: [20:34:03][Invoke-DMWmiFilter] Invalid input: 2! This command only accepts output objects from Test-DMWmiFilter