Help? OnComplete API: You must provide a value expression on the right-hand side of the '-' operator
my cmdlet scripting agent runs , happens. using -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: cmdlet extension agent index 5 has thrown exception in oncomplete(). exception is: microsoft.exchange.provisioning.provisioningexception: scriptingagent: exception thrown while invoking scriptlet oncomplete api: must provide value expression on right-hand side of '-' operator.. ---> system.management.automation.parseexception: must provide value expression on right-hand side of '-' operator. @ system.management.automation.runspaces.asyncresult.endinvoke() @ system.management.automation.powershell.endinvoke(iasyncresult asyncresult) @ microsoft.exchange.configuration.monaddataprovider.monadpipelineproxy.closepipeline(monadasyncresult asyncresult) --- end of inner exception stack trace --- @ microsoft.exchange.provisioningagent.scriptingagenthandler.oncomplete(boolean succeeded, exception e) @ 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
hi _exploreeverything,
based on research, not work add parameter -domaincontroller directly, please refer script modify script:
exchange 2010: set calendar permission on new users
i hope helps.
Windows Server > Windows PowerShell
Comments
Post a Comment