Getting "Access is denied" error during exporting the user class Unix properties.

Hi Team,

we are using the ARS command Get-QADUser for the target domain and the PowerShell command Get-ADUser for the source domain to synchronize UNIX attribute values from the source to the target. The script flow is as follows for UNIX attribute synchronization in the Target domain:

 

a. Check if the service account was created after a certain date in the Target domain, and verify if the same account exists in the Source domain.
b. If the account exists, export the UNIX attribute details from the Source domain and save them.
c. Use the exported details to set the values for the respective account in the Target domain, but only if the values are not already set in the Target domain.

Export completed for OU=ServiceAccts,OU=UsersAndGroups,OU=Accounts,DC=corp,DC=Target,DC=com. File saved to D:\Scripts\UnixAttribute\Corp_AD_User_Properties.csv.
PS>TerminatingError(Get-QADUser): "Access is denied.



Export-ARSUserDetails : Failed to export users from OU=ServiceAccts,OU=UsersAndGroups,OU=Accounts,DC=Source,DC=shared.
Error: Access is denied.

At D:\Scripts\UnixAttribute\syncAccount-UnixAttributeV1-3.ps1:154 char:1
+ Export-ARSUserDetails -OU $SharedOU -OutputFile $ADOutputFile -LogFil ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Export-ARSUserDetails
Export-ARSUserDetails : Failed to export users from
OU=ServiceAccts,OU=UsersAndGroups,OU=Accounts,DC=Source,DC=shared. Error: Access is denied.