0 votes

I am attempting to run a command using powershell. The command is using Google Apps Manager (GAM). Whenever the command runs and is successful, Powershell reports that it has failed and Adaxes see this with an exclamation point in the web operation feedback.

Here is a sample of the portion of code I am concerned with:

Invoke-Expression -command:"C:\googleapps_manager\gam.exe update group employees@company.com remove user mr.testy106"

There is some output when the command is being run from the command line and powershell. I think this is what is throwing Adaxes off. But $LastExitCode = 0 and there are no other errors that can be determined.

Here is a sample of the output after running the command:

removing mr.testy106@company.com

Here is the error from the web interface:
https://docs.google.com/file/d/0B30Z5VM ... edit?pli=1

Does anyone know what I might be doing wrong or how to get Adaxes to accurately report an error?

[edit]
To explain more clearly the issue and not appear as though this post describes an issue with Adaxes. The issue lies with the software I am using and how it works with Powershell.

by (290 points)
0

Hello,

Hmm ... that looks really strange. We've asked our script guys to have a look.

1 Answer

0 votes
by (216k points)
selected by
Best answer

Hello,

The reason for the issue is that some output from gam.exe is being sent to STDERR, and redirection works differently in PowerShell than in CMD.EXE. For more information on this issue, you can have a look at this post on the Stackoverflow forum.

To work around this issue, you can redirect the STDERR output to a PowerShell variable, and then update the Execution Log of the operation with the content of that variable using the $Context.LogMessage method. For example:

$commandResult = Invoke-Expression -command:"C:\gam-64\gam.exe update group employees@softerra.com remove user crashtestdummy 2>&1"
$Context.LogMessage($commandResult, "Information")
0

Your suggestion is perfect. Thank you.

Here is what I ended up doing (I took things a little further):

Import-Module Adaxes
$commandResult = Invoke-Expression -command:"C:\googleapps_manager\gam.exe user mr.testy106 deprovision 2>&1"
$myResult=$commandResult | Select-String -pattern "Error"
If ($myResult){
    $Context.LogMessage($commandResult, "Error")
}
Else {
    $Context.LogMessage($commandResult, "Information")
}

Notice the sample code is different than the OP, but it is much easier to test with and view.

0

Hello,

Thanks for your contribution. We really appreciate it.

Related questions

0 votes
1 answer

We use TOPdesk as our ITSM solution. Several departments are able to create new users. When a create user task fails we would like to receive the alert as the Adaxes ... Adaxes to sent out the incident to our TOPdesk. Is there a solution for this?

asked Oct 5 by mrkvd16 (20 points)
0 votes
1 answer

How can i différenciante the two user without opening each one of them ?

asked Jan 20 by eric.lebrun (20 points)
0 votes
1 answer

I would like users to use Adaxes to add themselves or others to a group, but instead of it just working, it has to go thru an approval process and be approved by the group owner before they are added. Thanks!

asked Jun 30, 2021 by RayBilyk (230 points)
0 votes
1 answer

Hi, we're receiving the below error when trying to add SMTP addresses to Office365 mailboxes from Adaxes. I've raised a ticket with support, but thought I'd ask ... , please see exception members for more information. Any help would be great. Thanks Gary

asked May 29, 2020 by gazoco (490 points)
0 votes
1 answer

Hi all, I want to create an external Username (username-ext). Loginname is the same as the initials. Changing the intiakls -> intials-ext ... CommandPipeline.Actions.ActionBase.Execute(ICommand command) --- Ende der internen Ausnahmestapel√ľberwachung ---

asked Jun 13, 2016 by massimo.ibba (450 points)
3,225 questions
2,925 answers
7,494 comments
534,171 users