Native Rule - PowerShell session error

Hi Experts,

We have a SailPoint AfterCreate rule that is configured for our AD source to create/enable remote mailboxes after the AD account gets created.

The Powershell script works fine in most cases, but when there is a bulk user creation activity (more than 50+) the script encounters a session error, probably because of the number of concurrent sessions running parallelly.

Here is the error that we receive - Cannot validate argument on parameter 'Session'. The argument is null. Provide a valid value for the argument, and then try running the command again.

We are using the Powershell AfterCreate template in the IDN documentation.

Also tried adding the below command in the PS script to close out each session, but that too did not help.

Remove-PSSession $ExchangeSession

Has anyone encountered similar issue.? Any suggestions would be much appreciated.

I have not faced this issue.

I think the issue is with arguments you are passing to the PowerShell script to Enable Remote mailbox, for some users an argument is missing but you might have set

[Parameter(Mandatory = $true)]

Add logs and check what is missing or what is happening for the failed users.

$so = New-PSSessionOption -SkipCNCheck
$ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -Credential $cred -ConnectionUri $msoExchangeURL -Authentication kerberos -SessionOption $so -Verbose

Import-PSSession $ExchangeSession -AllowClobber

Enable-RemoteMailbox -Identity $UPN -RemoteRoutingAddress $remoteaddress -ErrorAction Stop

Remove-PSSession $ExchangeSession

This is the command that we are using and looks like the error occurs during the Import-PSSession execution.

Instead of this , can you try
Remove-PSSession -Session $ExchangeSession or may be try Get-PSSession | Disconnect-PSSession to see if that helps.

Hi Sunny,

That did not seem to work for us.

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