protected Object ExecuteResolveUsername(String scriptName, ObjectClass objectClass, String username, OperationOptions options)
        {
            var result    = new MsPowerShellUidHandler();
            var arguments = new Dictionary <String, Object>
            {
                { Result, result },
                { Username, username }
            };

            ExecuteScript(GetScript(scriptName), CreateBinding(arguments, OperationType.RESOLVE_USERNAME, objectClass, null, null, options));
            return(result.Uid);
        }
        protected Uid ExecuteUpdate(String scriptName, ObjectClass objectClass, Uid uid,
                                    ICollection <ConnectorAttribute> updateAttributes, OperationOptions options)
        {
            var result = new MsPowerShellUidHandler {
                Uid = uid
            };
            var arguments = new Dictionary <String, Object>
            {
                { Result, result },
            };

            ExecuteScript(GetScript(scriptName), CreateBinding(arguments, OperationType.UPDATE, objectClass, uid, updateAttributes, options));
            return(result.Uid.GetUidValue() != null ? result.Uid : null);
        }
        protected Object ExecuteAuthenticate(String scriptName, ObjectClass objectClass, String username,
                                             GuardedString password, OperationOptions options)
        {
            var result    = new MsPowerShellUidHandler();
            var arguments = new Dictionary <String, Object>
            {
                { Result, result },
                { Username, username },
                { Password, SecurityUtil.Decrypt(password) }
            };

            ExecuteScript(GetScript(scriptName), CreateBinding(arguments, OperationType.AUTHENTICATE, objectClass, null, null, options));
            return(result.Uid);
        }
        protected Uid ExecuteCreate(String scriptName, ObjectClass objectClass, ICollection <ConnectorAttribute> createAttributes, OperationOptions options)
        {
            var result    = new MsPowerShellUidHandler();
            var arguments = new Dictionary <String, Object> {
                { Result, result }
            };

            if (ConnectorAttributeUtil.GetNameFromAttributes(createAttributes) != null)
            {
                arguments.Add(Id, ConnectorAttributeUtil.GetNameFromAttributes(createAttributes).GetNameValue());
            }

            ExecuteScript(GetScript(scriptName), CreateBinding(arguments, OperationType.CREATE, objectClass, null, createAttributes, options));
            return(result.Uid.GetUidValue() != null ? result.Uid : null);
        }