0 votes

Hi,

I have a lot of custom PowerShell scripts running and I am wondering, if its possible somehow to get

  • the name of the PS Script
  • the line of the execution of a code

Why? I would like to send out an email if error occurs and send directly the action, maybe path in Adaxes and line number of the script.

by (1.5k points)

1 Answer

0 votes
by (292k points)

Hello,

You can use try-catch blocks with the corresponding code to make the delivery. As for the script name, it has to be specified in the script itself.

As an alternative, you can schedule the Errors in Adaxes log report. By default, the report is located in container Reports\All Reports\Miscellaneous\Logging. However, in this case you will only get the information contained in the log and won’t have the ability to influence it.

0

Hi,

You can use try-catch blocks with the corresponding code to make the delivery. As for the script name, it has to be specified in the script itself.

So I can not get the name of the action/rule/etc itself and also not this name? image.png

And what is about the line number of the code, where the try/catch happens?


As an alternative, you can schedule the Errors in Adaxes log report. By default, the report is located in container Reports\All Reports\Miscellaneous\Logging. However, in this case you will only get the information contained in the log and won’t have the ability to influence it.

I know about this, but it does not really fit my needs yet. I had a similar question in past also (not sure if I ever followed it up^^)

0

Hello,

So I can not get the name of the action/rule/etc itself and also not this name?

Yes, that is correct. Unfortunately, there is no such possibility within the script itself.

And what is about the line number of the code, where the try/catch happens?

Unfortunately, there is no possibility to get it. However, in case of errors/warnings, usually, there is the line number included into the message.

Related questions

0 votes
1 answer

Hello, i have a custom command which sets the oof-message for the selected user. in this custom command i have a parameter "param-vertretung" (ad-object picker). Now i want to ... and email of the stand-in in the oof-message. Can you help me with that? Thanks

asked Nov 13, 2020 by lohnag (160 points)
0 votes
1 answer

Let's say I have a Business Rule that is fired prior to adding members to a group. Is it possible to get the number of objects being added to that group as ... that tells me that 6 objects will be added or is each added user treated completely independently?

asked Apr 20, 2022 by ngb (290 points)
0 votes
1 answer

Good morning, I need to get the serial number of PC and update the description with the value result. I tried with %serialNumber% but the is empty. Can u help me? thanks, Simone

asked Nov 17, 2021 by Simone.Vailati (430 points)
0 votes
1 answer

Is there a way to get the name of the user who approved a request and supply that to a step inside of a custom command? For example, HR submits a status change for an employee. ... and pass it as a param in a custom command that is called in one of the steps?

asked May 12, 2021 by davfount90 (20 points)
0 votes
1 answer

Hello How can I use a script to search for "123France - Create" in the business rules and replace the "123France - Create" with "France - Update"? This would be an ... done throughout the CN=Business Rules. It will always be searched for "123France - Create".

asked Aug 25, 2023 by DRiVSSi (300 points)
3,569 questions
3,259 answers
8,275 comments
547,962 users