cancel
Showing results for 
Search instead for 
Did you mean: 

How can I pass a Data Item/value into a PowerShell script as a parameter?

NBE
Level 2

I'm currently looping through a collection containing emails I'd like to query within AD using Utility - PowerShell. My current PowerShell script is as follows: 

"Param (
[String]$email
 
Get-ADUser -Filter {EmailAddress -eq $email} -Properties name | Select SamAccountName"
and my 'Parameters' input contains the following: "email = [Email]", where Email is a data item containing the email from the current record within the collection. This approach does not seem to work, and the output collection is populated with empty cells where the 'SamAccountName' should be returned. If I pass an example email into the 'Parameters' input the expected return is generated, but I can't seem to use the value stored within a data item in this way. I'm considering storing the value in the data item in a text file to be continuously updated and subsequently accessed by PowerShell each time, but that approach would be rather long winded especially if there's an easier way to plug in the value.
1 REPLY 1

Hi,

I am trying to understand the issue bit more. can you please explain the issue that you are facing with share the BP PowerShell utility Action screenshot? Also, can you share your collection variable.