Microsoft AD Spoke | You cannot call a method on a null-valued expression

Cuneyt
Tera Contributor

Hi,

We are trying to manage our Microsoft AD operations with Integration Hub, in order to do that we have completed the required steps such as credentials and mid server properties etc. But in the end when we try to make a simple action test such as Create User or Create Group, we are having an error. Says "You cannot call a method on a null-valued expression" 

From the mid agent logs:

Stack Trace: at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2022-01-07 17:38:08 (297) Worker-Expedited:IPaaSActionProbe-7346ca9b47b4811003587d01e36d4324 SEVERE *** ERROR *** Failed while executing ActionCreateNewGroup.ps1
2022-01-07 17:38:08 (297) Worker-Expedited:IPaaSActionProbe-7346ca9b47b4811003587d01e36d4324 SEVERE *** ERROR *** You cannot call a method on a null-valued expression.
HRESULT: [-2146233087]

 

Operation(Create Group./end) failed with error: com.snc.process_flow.exception.ProcessAutomationException: Powershell execution error at com.snc.process_flow.engine.ProcessEngine.catchPropagateOrThrowError(ProcessEngine.java:738) at com.snc.process_flow.engine.ProcessEngine.handleTreatAsError(ProcessEngine.java:829) at com.snc.process_flow.engine.ProcessEngine.executeOps(ProcessEngine.java:5...

 

Operation(Create Group.ed321adf877c8110fbaf52cabbbb35f1) failed with error: com.snc.process_flow.exception.OpException: Powershell execution error at com.snc.process_flow.operation.PowerShellOperation.invoke(PowerShellOperation.java:52) at com.snc.process_flow.operation.IntegrationOperation.run(IntegrationOperation.java:65) at com.snc.process_flow.engine.Operation.execute(Operation.java:202)...

 

Custom powershell action with a custom powershell script simply creates the group in the desired OU but the OOB action of Microsoft AD is failing.

 

Any ideas ? 

 

*Powershell version : 5.1.17763.2090 

6 REPLIES 6

Frank Tate
Giga Guru
Giga Guru

It looks to me like you're referencing a non-existent variable, $groupNameLocal. I see an Input Variable named groupName, but groupNameLocal doesn't exist. Can you try using $groupName in your PowerShell step?

Frank

Hi Frank,

We are trying to use the OOB Microsoft AD Spoke from integrationHub. So there is nothing to configure or edit in the powershell step because it is readOnly. 

Hi Cuneyt,

That's not the component you provided a screenshot of initially. In your original post, you had a screenshot of a custom (created by you) action named "test powershell", which had a PowerShell step that was was defined as an "inline script". That script was editable and referenced a non-existent variable named groupNameLocal. You now have attached a screenshot of the OOTB action named Create Group, which doesn't have this particular problem, but actually matches up with the error you were originally receiving (that original error pointed to the ActionCreateNewGroup.ps1 file that is called by the Create Group action).

With that clarification, how are you trying to test this action? Are you just clicking the Test button on the action? If so, it prompts you for the Group Name, Description, Credential, and Organizational Unit (OU). The OU you specify must already exist in AD, and the credential must have the appropriate access to AD. Are those conditions met in your case?

Also, the ActionCreateNewGroup.ps1 file is a Script File (path in Navigator: MID Servers->Script Files) that you can edit to add some additional logging using the Write-Host cmdlet. Personally, I would add some logging to the script to get additional insight into exactly what's going on.

Frank

There are two screenshots in the attachments actually. The custom powershell action is just to prove that powershell over midserver to create group or user works just fine. Using the same OU and the same information for group name etc. from the action test gives the related error. You may have a point, I didn't add any logging to the script file just to avoid altering OOB script file. Do you have any suggestions what kind of logging can I add ?