Get-AdUser using Invoke Power Shell activity

Hi Experts

Is it somehow possible to use the ActiveDirectory PowerShell command Get-AdUser in a UiPath flow? And can it be done without having to install the RSAT tool but add the .dll files instead?

I have tried by creating a text file with the following content:

Add-Type -Path 'C:\Temp\Microsoft.ActiveDirectory.Management.dll'
Add-Type -Path 'C:\Temp\Microsoft.ActiveDirectory.Management.resources.dll'

Import-Module ActiveDirectory

Get-AdUser -Identity johndoe

I read the text file by using the Read Text File activity. I then use the output as CommandText in the Invoke Power Shell and enable the IsScript.

But this returns the error:

Invoke Power Shell: The 'Get-AdUser' command was found in the module 'ActiveDirectory', but the module could not be loaded. For more information, run 'Import-Module ActiveDirectory'.

Any ideas?

Have you selected the IsScript property in UiPath powershell command?

Yes the IsScript is enabled