Jump to content

New Exchange Mailbox Using Powershell Via Copssh


devilish
 Share

Recommended Posts

Hello!

Maybe someone can help me on this topic.

I'm an absolute powershell noob but since we are getting MS Exchange it's time to learn.

All our unser management is based on linux. So I have to create ps scripts that one can start from linux using ssh. Scripts with new-aduser commands are running fine. Now I need to use "new-mailbox" so the script needs to load the Exchange PS Extensions and here is the problem.

Using

. RemoteExchange.ps1

Connect-ExchangeServer -auto

....

New-Mailbox -UserPrincipalName $PrincipalName -Alias $Alias -Database $Database -Name $User –OrganizationalUnit $OU -Password $secure -FirstName $First -LastName $Last -DisplayName $Name -ResetPasswordOnNextLogon $False -PrimarySmtpAddress $email -Force $true -EmailAddressPolicyEnabled $false

works fine localy. Via ssh

. RemoteExchange.ps1

Connect-ExchangeServer -auto

creates errors (missing registry keys etc). It looks like the RemoteExchange script trys to run using the copssh admin user and not the user connected by ssh.

So is there an other way to get the exchange cmdlets running in my script?

Any idears?

Link to comment
Share on other sites

Hello!

Ok, here is the solution. And the next problem...

Solution:

A powershell via CopSSH is 32 bit. The exchange cmdlets on my server are 64 bit. So they won't run. I've found a nice software. "Powershell SSH Server 5" from n/ software. It runs as a service and supports 64 bit powershell.

Now I can

- create users

- create mailboxes

But I need to create home-directories too:

Our home-directories are stored on DFS. Only administrator can create new directories unter \\domain\home .

First try: Do it direct on the domain controller.

Open a powershell as user "Administrator".

PS> whoami

PS> domain\Administrator

Run Script containing the new-item command for \\domain\home\username.

=> Directory created

Second try: Do it over SSH

Other system: Putty connection to domain controller as Administrator

PS> whoami

PS> domain\Administrator

Run the same script as above

=> Error, access denied

SSh Login user was the same user as the one opening the local powershell.

Powershell service runs under the same credentials (tryed "Service" account too)

So I am asking you: Has anyone a hint why the same user could not create the directory in an ssh session?

Edited by devilish
Link to comment
Share on other sites

Too me it sounds like you don't have permission to create directories over a SSH connection.

You will need to go over the permissions on your SSH server and make sure the account you are using has create directory permissions.

"Error, access denied" generally means you don't have the proper permissions/access to do a certain task.

Link to comment
Share on other sites

  • 3 months later...

From what I remember, you create all user data from Active Directory, and start the Exchange process in windows GUI, but have to complete the process in power shell. Exchange only creates the mailbox, so if the users don't exist already with their own file shares, etc, you need to create them first in Active Directory. Exchange will create the user in active directory, but they have no permissions or space quota from what I remember and no permissions. It basically fills in the name and info, but thats about it if you do it from exchange only. Someone correct me if I am wrong though.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...