Exchange mailbox creation via powershell

Hi there,

I am working on an automation where the BOT has to create a new user account in Active Directory and then create respective mailboxes in Exchange using powershell script already in use in my organization.
I am able to perform OCID creation step but creating mailboxes via powershell is giving me issues.
To add to this, I wont be able to test "mailbox creation " part in my dev environment, it can be tested in UAT env directly. So I am aiming at writing a piece of code with minimal errors to avoid going back and forth in two different environments.
I have below powershell script to integrate with uipath to create mailboxes for new user accounts:

Step 1
run powershell as a different user - (this is a part of the requirements: run powershell as a different user , passing user and password in the script itself, not expecting a credentials prompt asking for username/password)

Step 2
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://URI/PowerShell/ -Authentication Kerberos

Step 3
Import-PSSession $Session

Step 4 #Create Mailbox in EXO

Enable-RemoteMailbox userID -PrimarySmtpAddress emailID -RemoteRoutingAddress userID@domain.mail.onmicrosoft.com

Step 5 #Enable email address policy

Get-RemoteMailbox emailID | Set-RemoteMailbox -EmailAddressPolicyEnabled $True

Since this is my first time interacting with powershell via uipath , can anyone here explain how can I achieve this? I need help with:

  • how to run powershell as different user (not admin)
  • how to write the existing script in “invoke powershell” activity and how to pass variables?

Any help/input will be much appreciated

Thanks

Hello @kaurM!

It seems that you have trouble getting an answer to your question in the first 24 hours.
Let us give you a few hints and helpful links.

First, make sure you browsed through our Forum FAQ Beginner’s Guide. It will teach you what should be included in your topic.

You can check out some of our resources directly, see below:

  1. Always search first. It is the best way to quickly find your answer. Check out the image icon for that.
    Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.

  2. Topic that contains most common solutions with example project files can be found here.

  3. Read our official documentation where you can find a lot of information and instructions about each of our products:

  4. Watch the videos on our official YouTube channel for more visual tutorials.

  5. Meet us and our users on our Community Slack and ask your question there.

Hopefully this will let you easily find the solution/information you need. Once you have it, we would be happy if you could share your findings here and mark it as a solution. This will help other users find it in the future.

Thank you for helping us build our UiPath Community!

Cheers from your friendly
Forum_Staff