[Midpoint-dev] Problem creating a mailbox on an Exchange server using an SSH connector
Jason Toppler
topplerjason at gmail.com
Mon Sep 25 15:37:59 CEST 2023
Hi, all!
I have an Active Directory resource to which I added an SSH connector. My
goal is to create a mailbox on the Exchange server for a new user. For this
I use the following script:
* <script> <host>resource</host>
<language>powershell</language> <argument>
<name>givenName</name> <path>$user/givenName</path>
</argument> <argument> <name>familyName</name>
<path>$user/familyName</path> </argument>
<argument> <name>email</name> <script>
<code> email = user.getGivenName() +
user.getFamilyName() + '@idm.ru <http://idm.ru/>'
return email </code> </script>
</argument>
<code>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command ".
'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1';
Connect-ExchangeServer -auto -ClientApplication:ManagementShell;
New-Mailbox -Name $givenName$familyName -UserPrincipalName $email -Password
(ConvertTo-SecureString -String 'Pa$$word1' -AsPlainText -Force)"</code>
<operation>modify</operation> <order>after</order>
</script>*
The command to be executed looks like this:
*$givenName = 'Assol'; $familyName = 'Vandenguk2'; $email =
'AssolVandenguk2 at idm.ru <AssolVandenguk2 at idm.ru>';
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command ".
'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1';
Connect-ExchangeServer -auto -ClientApplication:ManagementShell;
New-Mailbox -Name $givenName$familyName -UserPrincipalName $email -Password
(ConvertTo-SecureString -String 'Pa$$word1' -AsPlainText -Force)"*
This doesn't work. I understand this because the command is executed in
cmd.exe, not powershell.
Is it possible to somehow make the command work?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint-dev/attachments/20230925/87168ded/attachment.htm>
More information about the midPoint-dev
mailing list