Search code examples
etlpentahopdi

Pentaho PDI || Windows Current User


PDI Version: 9.3

Environment: Windows Server

I'm trying to retrieve the username of the current user executing the transformation, with the aim of creating dynamic file paths based on this user information.

I used the "Get System Info" step:

  • Hostname (Real): Give me the server name
  • Hostname (Network Setup): Give me the server name

I was not able to get the current user how is executing the transformation.

enter image description here


Solution

  • You can use the step Add constant to add a shell command as String and then use the Execute a process step to execute it (The step execute the command for each row).

    For windows you can use the command cmd.exe /C echo %USERNAME% to get the current user.

    Transformation screenshot

    You'll get the result on Result output field.