Issue to API connection through RPC request

Hi @MVKR7T ,

I faced the below error when i use try and cath in my PS script.

**E n t e r i n g   S a i l P o i n t   r u l e **
**E r r o r :   I t e m   =     - >   M e s s a g e   =   C a n n o t   v a l i d a t e   a r g u m e n t   o n   p a r a m e t e r   ' S e s s i o n ' .   T h e   a r g u m e n t   i s   n u l l .   P r o v i d e   a   v a l i d   v a l u e   f o r   t h e   a r g u m e n t ,   a n d   t h e n   t r y   r u n n i n g   t h e   c o m m a n d   a g a i n . **
**E x i t i n g   S a i l P o i n t   r u l e**

can you please check

Hi @Remold ,

this is the command i ran before
Import-Module msonline
Connect-MsolService -Credential $cred

is it something with exchange online update to V3 due to which I am seeing this issue

1 Like

Hi @MVKR7T ,

Error message:

Cannot validate argument on parameter ‘Session’. The argument is null. Provide a valid value for the argument, and then try running the command again.

this is the error i have received when i tried try and cath with the PS script

1 Like

It is interesting to see you are still using session and basic authentication for connecting to Exchange Online which is deprecated.

I would suggest you to work with your Exchange Team, generally they give sample working PS script for creating any object in Exchange.

First make sure that, you are able to create DL or any other item in EXO directly using PS script then try to integrate with RPC.

2 Likes

Can you please please take a look at accepted answer on the Microsoft Forum post:

and let us know which of the steps mentioned you have performed?

We already know you have an issue and we have provided help, but I can not see what you have done :frowning:

– Remold

2 Likes

Hi @Remold ,

My PS script is working now. but not sure how it’s working in the backend as there are lot of users it’s not running through the script to assign groups. How can we validate and fix that any idea?

1st add some more debug logging in you PowerShell using:
Add-Content $logfile “Some debug data”
Also move the line $logfile = “E:\IQService\logsdl\removelog.txt”
Directly below Add-type -path “E:\IQService\Utils.dll” to have the $logfile as soon as possible :stuck_out_tongue_winking_eye:

Then change line:

Add-DistributionGroupMember -Identity $item -Member $email -ErrorAction silentlycontinue`

to

try {
Add-DistributionGroupMember -Identity $item -Member $email 
  catch {
    Add-Content $logfile “"ERROR Add-DistributionGroupMember for $( $item ) - $( $email ) failed with message $( $error[0].exception.message )."
  }

To make the errors visible in the log file. SilentContinue will continue to the next statement on errors and will not show the error it got.

Then I would go back to the test code you were using 10 days ago and call the PowerShell from within IdentityIQ for one or more users (who got no groups assigned) to see what the error is.

– Remold

1 Like

Hi ,

Can anyone explain how the distribution list works in the backend. My powershell script is working now but i don’t see the changes in the user sequentially. It’s working randomly and mostly the user who are already updated it’s currently updating it. Can anyone please help on this.

Regards
Amit

Hi,

can anyone please help with my query above.

A distribution list is a separate object and is managed within Exchange Online (MsolService). A distribution list has references to Users in Entra ID (Azure AD).
Users are managed via Entra ID and don’t have a reference to Msol distribution lists.

So you will not see any reference to a Msol distribution list on an Entra ID user.

– Remold

2 Likes

As I have mentioned already,

You need to develop PowerShell script for your requirements, we generally use to get relevant commands from our Exchange team, we just use to develop them to trigger through SailPoint and accept inputs from SailPoint account request.

Add-DistributionGroupMember -Identity "Staff" -Member "[email protected]"

You can iterate the users to add one by one to this command.

foreach ($user in $userList) {

Add-DistributionGroupMember -Identity "Staff" -Member $user

}

There are bunch of articles in google for this.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.