How can I pass a Data Item/value into a PowerShell script as a parameter?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
17-07-23 12:37 PM
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
24-07-23 04:39 AM
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.
