Hi everyone
Here comes a big one I try to automate some Exchange tasks via the Powershell Orchestrator application. I have tried several ways all of them work, when I execute them directly on the server or from the server where the Orchestration application is installed. They just never work running it with in the Workflow. To take one thing out of the way, the user has admin rights on all server and Exchange execution rights.
I post the script and then below the error.
Situation 1
Configuration: Exchange server
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
sleep 5
Set-MailboxAutoReplyConfiguration -Identity firstname.lastname@domain.com -AutoReplyState Enabled -InternalMessage "test" -ExternalMessage "test"
Result:
Active Directory operation failed on . The supplied credential for 'domain\service-account' is invalid. At line:3 char:1 + Set-MailboxAutoReplyConfiguration -Identity firstname.lastname@domain.com -Au ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) ], ADInvalidCredentialException + FullyQualifiedErrorId : Server=Exchange,RequestId=43695f51-e920-4105-bb3f-99a3b871789b,TimeStamp=8/11/2022 12:04:30 PM] FailureCategory=Cmdlet-ADInvalidCredentialException] 52ECAA27
Situation 2
Configuration: Exchange server
$session = New-PSSession -connectionURI "http://exchangeServer/powershell" -ConfigurationName Microsoft.Exchange
Import-PSSession -session $session
Set-MailboxAutoReplyConfiguration -Identity firstname.lastname@domain.com -AutoReplyState Enabled -InternalMessage "test" -ExternalMessage "test"
Result:
Connecting to remote server Exchange server failed with the following error message : A specified logon session does not exist. It may already have been terminated. For more information, see the about_Remote_Troubleshooting Help topic. At line:1 char:16 + ... $session = New-PSSession -connectionURI "http://exchangeServer ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) )New-PSSession], PSRemotingTransportException + FullyQualifiedErrorId : 1312,PSSessionOpenFailed Cannot validate argument on parameter 'Session'. The argument is null. Provide a valid value for the argument, and then try running the command again. At line:2 char:31 + Import-PSSession -session $session + ~~~~~~~~ + CategoryInfo : InvalidData: (:) )Import-PSSession], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.ImportPSSessionCommand The term 'Set-MailboxAutoReplyConfiguration' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:4 char:1 + Set-MailboxAutoReplyConfiguration -Identity firstname.lastname@domain.com -Au ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Set-MailboxAutoReplyConfiguration:String) )], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Situation 3
Configuration: Active Directory server
Same result as in situation 2.
I running on the server via Powershell it works fine.
Any ideas?
Thank you all!