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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2022 08:07 AM
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
- Labels:
-
Orchestration (ITOM)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2022 01:29 PM
I would make the script as follows. I believe that Write-Host will produce output you can see in the flow designer. If not, you may need to use "SNCLog-DebugInfo -Message" instead of Write-Host. Here's a link on enabling debugging if you need to do that. Script:
import-module "$executingScriptDirectory\ADSpoke\ActiveDirectoryMain"
Write-Host "Entering ActionCreateNewGroup.ps1"
if (test-path env:\SNC_groupname) {
$groupname = $env:SNC_groupname;
$organizationunit = $env:SNC_organizationunit;
$description = $env:SNC_description;
$grouptype = $env:SNC_grouptype;
Write-Host "ActionCreateNewGroup.ps1: computer = ${$computer}, groupname = ${$groupname}, organizationalunit = ${$organizationunit}, grouptype = ${$grouptype}"
};
$groupNameInvalid = $false;
if(($groupname -eq $null) -Or ($groupname -eq "")) {
$groupNameInvalid = $true;
Write-Host "Empty Group Name";
}
else {
$invalid = 60, 61, 42, 38, 34, 39, 47, 92, 62, 123, 125;
for($i =0 ;$i -lt $invalid.Count; $i++) {
if( $groupname.IndexOf($invalid[$i]) -ne -1 ) {
Write-Host "Invalid characters found in Group Name";
$groupNameInvalid = $true;
}
}
}
$groupTypeInvalid = $false;
SNCLog-ParameterInfo @("Running Create a new distribution Group", $groupname, $description, $grouptype)
if($grouptype -eq $null) {
$grouptype = 4
}
if(($grouptype -ne 2) -And ($grouptype -ne 4) -And ($grouptype -ne 8) -And ($grouptype -ne -2147483646) -And ($grouptype -ne -2147483644) -And ($grouptype -ne -2147483640)){
$groupTypeInvalid = $true;
Write-Host "Invalid Grouptype";
}
if(($groupNameInvalid -eq $false) -And ($groupTypeInvalid -eq $false) ) {
$objproperties = 'GroupType = ' + $grouptype + ' `n Description = ' + $description;
Write-Host "ActionCreateNewGroup.ps1: About to run createActiveDirectoryObject"
createActiveDirectoryObject -domainController $computer -type 'Group' -organizationUnit $organizationunit -useCred $true -credential $cred -objectProperties $objproperties -objectName $groupname
}
Frank

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2024 01:02 PM - edited ‎12-11-2024 01:04 PM
I have this exact problem in Xanadu. Have you resolved this?