Enable Mailbox script query for Sailpoint ISC

Hi Folks,

While looking at a powershell snippet for enable mailbox, I came across the below line:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $ExchangeUrl -Authentication Kerberos -Credential $creds

Now my question is that from where do we get the value for $creds.

Note : Since I am new to ISC and Powershell so just for my knowledge i am asking

Hi @Amsingh1

For the $creds value, could you try the following code:

$username = $application.getAttributeValue("IQServiceUser")
$password = $application.getAttributeValue("IQServicePassword")
$securePass = ConvertTo-SecureString $password -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential($username, $securePass)

This should be able to get the IQService credentials from the AD source.

@Amsingh1 - Here is sample Script to create/enable mailbox


		# Connect Exchange-PSSession
		$sessionOption = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck
		$ExchangeURL = "https://mail.seciampam.com/PowerShell/"
		$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $ExchangeURL -Authentication basic -Credential $UserCredential -SessionOption $sessionOption
		Import-PSSession $Session

		# Importing Active Directory Module
		Import-Module activedirectory
		
		# New MailBox properties				
		New-Mailbox -Name $samAccountName -OrganizationalUnit $WinOU -UserPrincipalName $UPN
	
		# Disconnect Exchange-PSSession
		Disconnect-PSSession -Name $Session
		  
	

Regards,

Kannan