Access denied importing Boolean value
I have been struggling with an odd issue. I have a number of PowerShell connectors in my solution, and quite a few of them have Boolean attributes (in addition to String). I have created a new connector which is very similar to the existing ones, and uses very similar scripts. Here is what is happening:
- When I comment out my import step for the Boolean attribute (so it just imports the String attributes) the full import works
- When I add the Boolean attribute in the import fails with "Access Denied". I know the correct value is actually being generated as I'm dropping a debug log file which shows all the values it's trying to put into the entity.
- When I run a Polling import (where I can list account names in a text file and it just imports those) it works correctly, including bringing in the Boolean value. This is also weird as it's the same Powershell script - the differences are in the initial collection of data, but the part where it updates and commits the entities is identical for both full and polling imports.
I thought it might be something to do with $null values but have made sure that the script always sets a default value of $false. This is the error message - it is definitely happening during the loop where I go through the data I've collected committing the entities.
I've also upgraded IdB to 5.2, but no change from 5.1 on this issue.
Change detection engine import all items for connector PowerShell HomeFolder failed with reason Access is denied. Duration: 00:01:19.9160765
Error details:
System.UnauthorizedAccessException: Access is denied ---> System.ComponentModel.Win32Exception: Access is denied
--- End of inner exception stack trace ---
at Unify.Framework.Auditing.AuditingExtensions.<>c__DisplayClass4_0.<TaskContinueWithExceptionPassthough>b__0(Task t)
at System.Threading.Tasks.Task.Execute()",Normal
Answer
Via phone call, the problem was that the line which was being commented out includes a call to Test-Path
, and we believe the permissions error is happening there.
Yes it was the Test-Path - failing for one home folder. The error message was somehow being suppressed by my putting "$ErrorActionPreference = Continue" in the script. One this was changed to "Stop" I got a proper error message, so I will be using that in all my connector scripts from now on.
Customer support service by UserEcho
Via phone call, the problem was that the line which was being commented out includes a call to
Test-Path
, and we believe the permissions error is happening there.