You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Details of the scenario you tried and the problem that is occurring
Where a configuration contains both a Parent Organziational Unit and a child of that Parent, it is not possible to successfully call either Get-TargetResource or Test-TargetResource, as they throw an exception where the Parent object doesn't exist.
Verbose logs showing the problem
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = TestConfiguration,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer DC01 with user sid S-1-5-21-#######-########-########-1531.
VERBOSE: [DC01]: LCM: [ Start Compare ]
VERBOSE: [DC01]: LCM: [ Start Resource ] [[ADOrganizationalUnit]DoesNotYetExist]
VERBOSE: [DC01]: LCM: [ Start Test ] [[ADOrganizationalUnit]DoesNotYetExist]
VERBOSE: [DC01]: [[ADOrganizationalUnit]DoesNotYetExist] Retrieving OU 'DoesNotYetExist' from path 'DC=contoso,DC=com'. (ADOU0001)
VERBOSE: [DC01]: [[ADOrganizationalUnit]DoesNotYetExist] OU 'DoesNotYetExist' does not exist when it should exist. (ADOU0009)
VERBOSE: [DC01]: LCM: [ End Test ] [[ADOrganizationalUnit]DoesNotYetExist] False in 0.8910 seconds.
VERBOSE: [DC01]: LCM: [ End Resource ] [[ADOrganizationalUnit]DoesNotYetExist]
VERBOSE: [DC01]: LCM: [ Start Resource ] [[ADOrganizationalUnit]ChildA]
VERBOSE: [DC01]: LCM: [ Start Test ] [[ADOrganizationalUnit]ChildA]
VERBOSE: [DC01]: [[ADOrganizationalUnit]ChildA] Retrieving OU 'ChildA' from path 'OU=DoesNotYetExist,DC=contoso,DC=com'. (ADOU0001)
VERBOSE: [DC01]: LCM: [ End Test ] [[ADOrganizationalUnit]ChildA] False in 0.1560 seconds.
VERBOSE: [DC01]: LCM: [ FAILEDCompare ] Completed processing compare operation. The operation returned False.
PowerShell DSC resource MSFT_ADOrganizationalUnit failed to execute Test-TargetResource functionality with error message: System.Exception: The Path 'OU=DoesNotYetExist,DC=contoso,DC=com' was not found. (ADOU0011)
+ CategoryInfo : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName : localhost
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 2.254 seconds
Suggested solution to the issue
The resource should be returned as being absent, rather than throw an exception.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
ConfigurationtestConfiguration {
[CmdletBinding(SupportsShouldProcess=$false,PositionalBinding=$false)]
param(
)
if (!$PSBoundParameters.ContainsKey('OutputPath')) {
Throw"A OutputPath parameter is mandatory."
}
if ($null-eq$Domain)
{
$Domain=Get-ADDomain
}
Import-DscResource-ModuleName PSDesiredStateConfiguration
Import-DscResource-ModuleName ActivedirectoryDsc
ADOrganizationalUnit DoesNotYetExist
{
Name ="DoesNotYetExist"
Path =$Domain.distinguishedName
Ensure ='Present'
}
ADOrganizationalUnit ChildA
{
Name ="ChildA"
Path = ("OU=DoesNotYetExist,"+$Domain.distinguishedName)
Ensure ='Present'
DependsOn ='[ADOrganizationalUnit]DoesNotYetExist'
}
ADOrganizationalUnit ChildB
{
Name ="ChildB"
Path = ("OU=DoesNotYetExist,"+$Domain.distinguishedName)
Ensure ='Present'
DependsOn ='[ADOrganizationalUnit]DoesNotYetExist'
}
}
The operating system the target node is running
OsName : Microsoft Windows Server 2016 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsBuildLabEx : 14393.3442.amd64fre.rs1_release.191219-1727
OsLanguage : en-US
OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
Details of the scenario you tried and the problem that is occurring
Where a configuration contains both a Parent Organziational Unit and a child of that Parent, it is not possible to successfully call either Get-TargetResource or Test-TargetResource, as they throw an exception where the Parent object doesn't exist.
Verbose logs showing the problem
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = TestConfiguration,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer DC01 with user sid S-1-5-21-#######-########-########-1531.
VERBOSE: [DC01]: LCM: [ Start Compare ]
VERBOSE: [DC01]: LCM: [ Start Resource ] [[ADOrganizationalUnit]DoesNotYetExist]
VERBOSE: [DC01]: LCM: [ Start Test ] [[ADOrganizationalUnit]DoesNotYetExist]
VERBOSE: [DC01]: [[ADOrganizationalUnit]DoesNotYetExist] Retrieving OU 'DoesNotYetExist' from path 'DC=contoso,DC=com'. (ADOU0001)
VERBOSE: [DC01]: [[ADOrganizationalUnit]DoesNotYetExist] OU 'DoesNotYetExist' does not exist when it should exist. (ADOU0009)
VERBOSE: [DC01]: LCM: [ End Test ] [[ADOrganizationalUnit]DoesNotYetExist] False in 0.8910 seconds.
VERBOSE: [DC01]: LCM: [ End Resource ] [[ADOrganizationalUnit]DoesNotYetExist]
VERBOSE: [DC01]: LCM: [ Start Resource ] [[ADOrganizationalUnit]ChildA]
VERBOSE: [DC01]: LCM: [ Start Test ] [[ADOrganizationalUnit]ChildA]
VERBOSE: [DC01]: [[ADOrganizationalUnit]ChildA] Retrieving OU 'ChildA' from path 'OU=DoesNotYetExist,DC=contoso,DC=com'. (ADOU0001)
VERBOSE: [DC01]: LCM: [ End Test ] [[ADOrganizationalUnit]ChildA] False in 0.1560 seconds.
VERBOSE: [DC01]: LCM: [ FAILEDCompare ] Completed processing compare operation. The operation returned False.
PowerShell DSC resource MSFT_ADOrganizationalUnit failed to execute Test-TargetResource functionality with error message: System.Exception: The Path 'OU=DoesNotYetExist,DC=contoso,DC=com' was not found. (ADOU0011)
+ CategoryInfo : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName : localhost
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 2.254 seconds
Suggested solution to the issue
The resource should be returned as being absent, rather than throw an exception.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
OsName : Microsoft Windows Server 2016 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsBuildLabEx : 14393.3442.amd64fre.rs1_release.191219-1727
OsLanguage : en-US
OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
PSVersion 5.1.14393.3383
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.3383
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version of the DSC module that was used
5.0.0
The text was updated successfully, but these errors were encountered: