Hi
I have a problem with my script, It makes an AD-User und then it should make the mailbox too.
The AD-User is no problem but then in the Invoke command im gives me the mistake
+ CategoryInfo : NotSpecified: (:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
+ PSComputerName : myExchangeServer
Process is terminated due to StackOverflowException.
My Invoke-COmmand:
$UPN = luca.wirths@mydomain.com #UserPrincipalName
$database = "DB01"
$EXSession = New-PSSession -computername "myExchangeServer.mydomain.local" -Credential $Credentials
Invoke-Command -Session $EXSession -ArgumentList $UPN, $database -ScriptBlock{
param(
$UPN ,
$database
)
Write-Host $UPN, $database
\\myExchangeServer\C$\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -version 2.0 -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto ; Enable-Mailbox $UPN -Database $database"
}
If I type the Enable-Mailbox on the Exchangeserver it works.
Does anyone see the mistake?
Thanks Luca