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