Title: Add custom value in PowerShell output table
Tags: powershell
Question: I have a list of application web URLs, wherein I am trying to monitor HTTP statuscode of the web URL by ```Invoke-WebRequest``` command method.

I got the list objects by below command:

```Invoke-WebRequest https://example.com/123 | Get-Member
```

Here, I am using statuscode and statusdescription fields to include it in output:

```Invoke-WebRequest https://example.com/123 |
    Select-Object StatusCode, StatusDescription |
    ft -a
```

Now I wish to include a custom name of URL in output before statuscode and statusdescription so that output will look like below


URL          StatusCode StatusDescription
---          ---------- -----------------
abc web page        200 OK       


Comment: How do you build the custom name? In general I'd use a calculated property with `Select-Object @{n='URL';e={'abc web page'}},StatusCode,StatusDescription`

Comment: I might be horribly wrong in interpreting how to write code, but I wrote below lines before original code ,
$URL = Add-Member -NotePropertyName URL -NotePropertyValue abc web page and
Invoke-WebRequest https://example.com/123 |
    Select-Object URL, StatusCode, StatusDescription |
    ft -a

Do I need to write Add-object instead of add-member?

Comment: Hi, welcome to stackoverflow, kindly please read [mcve] and review the post, otherwise you can expect closing because its so general and doesnt mentioning any self effort, we are here to help you, but not to do the tasks instead of you :). Thanks in advance.

Comment: Personally, I can suggest you to define an array with the all addresses, then iterate over this given array, and print out the values (for URL you can use index in array)

Comment: Doesnt matter how correct or incorrect your code will be, just try to take a look for some info over the internet and try to do your best, if you will stuck on something specific, I am pretty sure you will get the help over there. People just dont wanna be bothered by general and broad questions, because it's hard to answer to them, eg. in this case, there are many ways.. `Add-Member` is "adding custom parameter to the variable" for further usage, eg., if you dont need/want to store values, it can be pretty more easier, eg.

Comment: Sounds cool. What have you tried to make it work?

Here is the accepted answer: If you dont need to store data in variables, and just print is fine for you 

```$URLsources = "http://fooo/fooURL1:800","http://fooo/fooURL2:800","http://fooo/fooURL2:800"

#table definition
    $tabName = "Output table"

    #Create Table object
    $table = New-Object system.Data.DataTable “$tabName”

    #columns definition
    $col1URL = New-Object system.Data.DataColumn URL,([string])
    $col2Status = New-Object system.Data.DataColumn Status,([string])
    $col3Desc = New-Object system.Data.DataColumn Desc,([string])

    #add columns
    $table.Columns.Add($col1URL)
    $table.Columns.Add($col2Status)
    $table.Columns.Add($col3Desc)


foreach($url in $URLsources){
  $result = Invoke-WebRequest $url 

  #preparation of the row
      $row = $table.NewRow()
      $row.URL= $url
      $row.Status= $result.StatusCode
      $row.Desc= $result.StatusDescription

  #add row to the table  
  $table.Rows.Add($row)

}

#print out the table
$table | format-table -AutoSize 
```

Comment for this answer: Welcome, just for the next time please try to investigate on your own first, actually with my minimal knowledge of powershell took me ~15 min of work with testing :)
Will appreciate if you will mark answer as accepted.
Comment for this answer: check also @guiwhatsthat solution, but did not worked for me, maybe another PS version or something

Here is another answer: You can add everything to your output:

```Invoke-WebRequest www.google.com | Select-Object -Property @{n="URL";e={'Any Name'}},StatusCode, StatusDescription```

If you want the real url which you checked in your output you could do it like that:

```Invoke-WebRequest www.google.com | Select-Object -Property @{n="URL";e={$_.BaseResponse.ResponseUri.Host}},StatusCode, StatusDescription```

Comment for this answer: Thanks a lot... This is a simple way to solve this... Many thanks

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 6, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2019:00:02/12/19', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<powershell>', 'Title': 'Add custom value in PowerShell output table', 'ViewCount': 2604, 'id': 54648600, 'user_AboutMe': None, 'user_AccountId': 15316587.0, 'user_DisplayName': 'Rohit Kulkarni', 'user_Reputation': 23.0, 'user_Views': 2.0, 'user_id': 11050315.0}}