Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7765605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:12:25+00:00 2026-06-01T15:12:25+00:00

Current Version of the Question: I initialize an array $tbd_list as follows: $tbd_list =

  • 0

Current Version of the Question:

I initialize an array $tbd_list as follows:

$tbd_list = @()
foreach($i in $tbd) {
    # -- If statement prevents duplicate id's
    if(!($tbd_list -match $i.id)){
        $tbd_list += $i.id
    }
}

At this point, if I print $tbd_list I get:

"dce50fdd-2298-45db-8aac-fb13a176fe1a*.*"
"79c1538f-09b1-4ed7-b84c-ff1a7934596a*.*"
"60511686-7a87-4352-a781-62e7c04913e5*.*"
"0821f8ee-c1ca-4568-ab68-bb5e30d07268*.*"
"3b9f5da0-fc2d-49e3-a11d-943f5ac2296a*.*"
"ff7720fd-2c0f-43c8-871a-e283f231c823*.*"

($tbd_list.GetType().FullName returns System.Object)

I then try to run the following code:

Get-ChildItem F:\store_test\ -Recurse -Include $tbd_list

But, I get nothing in return.

However, if I manually type this:

$tbd_list = "dce50fdd-2298-45db-8aac-fb13a176fe1a*.*", "79c1538f-09b1-4ed7-b84c-ff1a7934596a*.*", "60511686-7a87-4352-a781-62e7c04913e5*.*", "0821f8ee-c1ca-4568-ab68-bb5e30d07268*.*", "3b9f5da0-fc2d-49e3-a11d-943f5ac2296a*.*", "ff7720fd-2c0f-43c8-871a-e283f231c823*.*"

At this point, if I print $tbd_list I still get:

"dce50fdd-2298-45db-8aac-fb13a176fe1a*.*"
"79c1538f-09b1-4ed7-b84c-ff1a7934596a*.*"
"60511686-7a87-4352-a781-62e7c04913e5*.*"
"0821f8ee-c1ca-4568-ab68-bb5e30d07268*.*"
"3b9f5da0-fc2d-49e3-a11d-943f5ac2296a*.*"
"ff7720fd-2c0f-43c8-871a-e283f231c823*.*"

and run the same line ($tbd_list.GetType().FullName still returns System.Object):

Get-ChildItem F:\store_test\ -Recurse -Include $tbd_list

It works perfectly. Any suggestions?

Solution

Both answers below are correct, but I can only choose one.

After making sure the variable was an array, I then had to remove the leading and trailing quotes and the script works. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:12:26+00:00Added an answer on June 1, 2026 at 3:12 pm

    $tbd_list.GetType().FullName gives System.String

    While not apparent from your question how you defined the $tbd_list, but it should have been an array and only if it were an array would it work with Get-ChildItem‘s Include option. It wouldn’t work in the way you expect if it were a string. Define it properly:

    $tbd_list = "dce50fdd-2298-45db-8aac-fb13a176fe1a*.", "79c1538f-09b1-4ed7-b84c-ff1a7934596a.*", "dce50fdd-2298-45db-8aac-fb13a176fe1a*.", "79c1538f-09b1-4ed7-b84c-ff1a7934596a.*", "dce50fdd-2298-45db-8aac-fb13a176fe1a*.", "60511686-7a87-4352-a781-62e7c04913e5.*", "0821f8ee-c1ca-4568-ab68-bb5e30d07268*.", "3b9f5da0-fc2d-49e3-a11d-943f5ac2296a.*", "ff7720fd-2c0f-43c8-871a-e283f231c823*.*"
    

    Using the above line works for me with Get-ChildItem

    Update:

    This is where you are doing it wrong:

    $tbd_list = "$tbd_list, " + $i.id
    

    It will construct a string.

    You will have to initialize $tbd_list as an array:

    $tbd_list = @()
    

    and add the items you want to it:

    $tbd_list += $i.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to upgrade my current version of DNN this week. I am currently
[This is an updated version of a question posted earlier, the previous title was
A little update to the common question. As of the current version of Nodejs
The current version of hadoop-streaming requires a Java class for the combiner, but i
I have downloaded the current version of Db4Objects (7.4) and installed it. It appears
Is there a way to identify the current version of IIS / using NSIS
How is performance in the current version (4.7) of Accurev ? time to checkout
How do you check the current version of eclipse that I am currently running?
I'm not clear on the differences between the current version of Ruby (1.8) and
Anyone familiar with specific security issues in the current version of DotNetNuke? (I've already

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.