Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Help? OnComplete API: You must provide a value expression on the right-hand side of the '-' operator

$
0
0

My Cmdlet Scripting Agent runs and this is what happens. Am I using the -Domaincontroller command correctly?

My script:

<?xml version="1.0" encoding="utf-8"?><Configuration version="1.0"><Feature Name="MailboxProvisioning" Cmdlets="new-mailbox"><ApiCall Name="OnComplete">
   if($succeeded)    { 
	$dc = "dc1.domain.com"
	start-sleep -s 10
	$newmailbox = $provisioningHandler.UserSpecifiedParameters["Name"] -DomainController $dc
    Get-mailbox $newmailbox | ForEach-Object {Set-MailboxFolderPermission $_":\Calendar" -User default -AccessRights Reviewer} -DomainController $dc
   }</ApiCall></Feature></Configuration>


My error:

Summary: 1 item(s). 1 succeeded, 0 failed.
Elapsed time: 00:00:03


test500
Completed

Warning:
The cmdlet extension agent with the index 5 has thrown an exception in OnComplete(). The exception is: Microsoft.Exchange.Provisioning.ProvisioningException: 

ScriptingAgent: Exception thrown while invoking scriptlet for OnComplete API: You must provide a value expression on the right-hand side of the '-' operator.. 

---> System.Management.Automation.ParseException: You must provide a value expression on the right-hand side of the '-' operator.
   at System.Management.Automation.Runspaces.AsyncResult.EndInvoke()
   at System.Management.Automation.PowerShell.EndInvoke(IAsyncResult asyncResult)
   at Microsoft.Exchange.Configuration.MonadDataProvider.MonadPipelineProxy.ClosePipeline(MonadAsyncResult asyncResult)
   --- End of inner exception stack trace ---
   at Microsoft.Exchange.ProvisioningAgent.ScriptingAgentHandler.OnComplete(Boolean succeeded, Exception e)
   at Microsoft.Exchange.Provisioning.ProvisioningLayer.OnComplete(Task task, Boolean succeeded, Exception exception)

Exchange Management Shell command completed:
New-Mailbox -Name 'test500' -Alias 'test500' -UserPrincipalName 'test500@domain.com' -SamAccountName 'test500' -FirstName 'test500' -Initials '' -LastName '' 

-Password 'System.Security.SecureString' -ResetPasswordOnNextLogon $false -Database 'SMDB1'

Elapsed Time: 00:00:03



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>