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
When you want to remove the sitelink ensure absent generate false positive test-targetresource false and set-targetresource "site link is not found"
Details of the scenario you tried and the problem that is occurring
I created the site using DSC and now I want to remove them, switching the parameter from present to absent. Site resource is working fine, deletes the site but site link resource is failing because it doesn't have ensure absent scenario implemented properly
Verbose logs showing the problem
$invokeParams = @{
Name = 'ADReplicationSiteLink'
ModuleName = 'ActiveDirectoryDsc'
Method = 'Test'
Property = @{
'name' = 'DefaultToIsolatedSiteLink';
'ensure' = 'Absent';
'cost' = 100;
'replicationfrequencyInMinutes' = 120;
'sitesIncluded' = @('Default-First-Site-Name', 'SITE-NAME')
}
}
Invoke-DscResource -verbose @invokeparams
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = ResourceTest,'className' = MSFT_DSCL
ocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer DCNAME with user sid S-1-5-21-3783069819-4113108839-4053356624-180474.
VERBOSE: [DCNAME]: LCM: [ Start Test ] [[ADReplicationSiteLink]DirectResourceAccess]
VERBOSE: [DCNAME]: [[ADReplicationSiteLink]DirectResourceAccess] Could not find DefaultToIsolatedSite
Link site link. (ADRSL0008)
VERBOSE: [DCNAME]: [[ADReplicationSiteLink]DirectResourceAccess] Site: Default-First-Site-Name not fo
und in SitesIncluded. Current SitesIncluded: . (ADRSL0001)
VERBOSE: [DCNAME]: [[ADReplicationSiteLink]DirectResourceAccess] Site: SITE-NAME not
found in SitesIncluded. Current SitesIncluded: . (ADRSL0001)
VERBOSE: [DCNAME]: [[ADReplicationSiteLink]DirectResourceAccess] Cost is not in desired state Current
: Desired: 100. (ADRSL0003)
VERBOSE: [DCNAME]: [[ADReplicationSiteLink]DirectResourceAccess] ReplicationFrequencyInMinutes is not
in desired state Current: Desired: 120. (ADRSL0003)
VERBOSE: [DCNAME]: LCM: [ End Test ] [[ADReplicationSiteLink]DirectResourceAccess] False in 0.3120 seconds.
VERBOSE: [DCNAME]: LCM: [ End Set ] in 0.6250 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
InDesiredState
--------------
False
VERBOSE: Time taken for configuration job to complete is 0.774 seconds
$invokeParams = @{
Name = 'ADReplicationSiteLink'
ModuleName = 'ActiveDirectoryDsc'
Method = 'Set'
Property = @{
'name' = 'DefaultToIsolatedSiteLink';
'ensure' = 'Absent';
'cost' = 100;
'replicationfrequencyInMinutes' = 120;
'sitesIncluded' = @('Default-First-Site-Name', 'SITE-NAME')
}
}
Invoke-DscResource -verbose @invokeparams
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = ResourceSet,'className' = MSFT_DSCLo
calConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer DCNAME with user sid S-1-5-21-3783069819-4113108839-4053356624-180474.
VERBOSE: [DCNAME]: LCM: [ Start Set ] [[ADReplicationSiteLink]DirectResourceAccess]
VERBOSE: [DCNAME]: [[ADReplicationSiteLink]DirectResourceAccess] Removing AD Site Link DefaultToIsola
tedSiteLink. (ADRSL0007)
Cannot find an object with identity: 'DefaultToIsolatedSiteLink' under: 'CN=Inter-Site
Transports,CN=Sites,CN=Configuration,DC=DOMAIN,DC=LOC'.
+ CategoryInfo : ObjectNotFound: (DefaultToIsolatedSiteLink:) [], CimException
+ FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,Micros
oft.ActiveDirectory.Management.Commands.RemoveADReplicationSiteLink
+ PSComputerName : localhost
VERBOSE: [DCNAME]: LCM: [ End Set ] [[ADReplicationSiteLink]DirectResourceAccess] in 0.3440 seconds.
The PowerShell DSC resource '[ADReplicationSiteLink]DirectResourceAccess' with SourceInfo '' threw one or more
non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel
called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
+ CategoryInfo : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : localhost
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 0.742 seconds
Suggested solution to the issue
Implement same logic as in the ADReplicationSite resource
if ($getTargetResourceResult.Ensure -eq 'Absent')
{
# Site doesn't exist
if ($getTargetResourceResult.Ensure -eq $Ensure)
{
# Site should not exist
Write-Verbose -Message ($script:localizedData.ReplicationSiteInDesiredState -f $Name)
}
else
{
#Site should exist
Write-Verbose -Message ($script:localizedData.ReplicationSiteNotInDesiredState -f $Name)
$configurationCompliant = $false
}
}
The DSC configuration that is used to reproduce the issue (as detailed as possible)
Thank you for raising this issue @wmaniek123. I have edited your issue to format it, but it looks to me as if you have pasted the verbose logs twice. Can you double check and edit as applicable. Also, you don't need to paste the Windows event logs, the DSC verbose output is good enough.
You mention that you are using v4.2 of the module because of another bug. What bug is this and is there an issue already raised for it?
Thanks for comment @X-Guardian . I'm using this version becasue of #582 witch was closed but still in preview I belive. I cleaned up the logs and raised pull request witch is simple elseif clause.
When you want to remove the sitelink ensure absent generate false positive test-targetresource false and set-targetresource "site link is not found"
Details of the scenario you tried and the problem that is occurring
I created the site using DSC and now I want to remove them, switching the parameter from present to absent. Site resource is working fine, deletes the site but site link resource is failing because it doesn't have ensure absent scenario implemented properly
Verbose logs showing the problem
Suggested solution to the issue
Implement same logic as in the ADReplicationSite resource
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
Version and build of PowerShell the target node is running
Version of the DSC module that was used
Using this one becasue of the bug in the passwordauthentication property (site link code is the same)
The text was updated successfully, but these errors were encountered: