11-09-23 12:38 PM
Hi Team, We have a requirement where with user email id we need to know whether he is an active user in organization or user left the organization. In order to do that we are using powershell Get -ADUser commands.
When i pass only powershell script in "PowerShellScriptCode" variable we are not getting any output or no error too. Manually the same script is working fine
Sample - Get-ADUser -property manager, department -Filter {EmailAddress -like "user@xyz.com"}
Please let us know if you have faced this issue or is there any better way to handle this scenario. Thanks in Advance
------------------------------
sai bhargava raja
Consultant
Deloitte
Asia/Kolkata
------------------------------
11-09-23 04:46 PM
Hi sai bhargava raja - Just to understand this bit more - are you able to run any other powershell script files ?and when you say you were able to run it manually was it inside your robot's environment or your primary account?
I did try running a sample powershell script by just placing the file path in the "Test Script" and using the "Run Script" action and it ran successfully.
12-09-23 12:20 AM
12-09-23 06:59 AM
Thank You for the response Mukesh.
Actually i'm using powershell for the first time, please excuse me if my query is not clear.
1.I'm just passing my sample query in "PowerShell Script Code" and not passing any filename or other parameters in Run Script action.
2.Yes when i say manually, i'm able to execute the query/commands in my bot local environment.
Also if you are able to run below command, can you please guide me with few more details/screenshots of it?
Sample - Get-ADUser -property manager, department -Filter {EmailAddress -like "user@xyz.com"}
Thanks in advance
------------------------------
sai bhargava raja
Consultant
------------------------------
12-09-23 07:01 AM
Thank you for the response, Leonardo. Can you please provide some more details on the security settings which you mentioned. I will check with my application support team.
------------------------------
sai bhargava raja
Consultant
Deloitte
Asia/Kolkata
------------------------------
12-09-23 10:25 AM
sai bhargava raja - I cannot run AD Module as its not available in my machine and if you have it you can customise your script to fetch data from list of email ids in CSV and write back the results to a Text/CSV file as well - Just for testing refer below screenshots for one of other script file I am using -
Example:
I would run my powershell scripts by giving the path of my script file with extension as .ps1 (write the script in notepad and save it with extension as .ps1) - powershell script that I have with me as sample script below is for toggling the caps lock on if its off) -
Script:
if ([console]::CapsLock -ne 'True')
{
$wsh = New-Object -ComObject WScript.Shell;
$wsh.SendKeys('{CAPSLOCK}')
}
Params for Run Script :
[PowerShellScriptCode] : Get-CimInstance -ClassName Win32_ComputerSystem
[Test Script] : Path of your .ps1 file
12-09-23 02:01 PM
Hello, ask them to check if the security option "Prevent access to command prompt" is enabled.
Steps : https://youtu.be/pe6u_XacNbU
Regards,