4

When I am trying to use Join-Object it is throwing the following error:

The term 'join-object' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

I am not sure why it is throwing this error.

My current version of Windows PowerShell is 3.0.

Mark Wragg
  • 22,105
  • 7
  • 39
  • 68
Harsh Jaswal
  • 447
  • 3
  • 14
  • See: [Join-Object](https://stackoverflow.com/a/45483110/1701026) in [In Powershell, what's the best way to join two tables into one?](https://stackoverflow.com/questions/1848821/in-powershell-whats-the-best-way-to-join-two-tables-into-one/45483110#45483110) – iRon Nov 02 '17 at 10:11

2 Answers2

3

Join-Object is not a built in cmdlet in any current version of PowerShell, but several people have written versions of it. For example there's this one which is part of the PSExcel Module:

https://www.powershellgallery.com/packages/PSExcel/1.0.2/Content/Join-Object.ps1

You could save that script as a .ps1 file on your local machine and then run it. After which you will have the Join-Object cmdlet for that session. Or you could install the PSExcel PowerShell module per the instructions here as this module contains the Join-Object cmdlet.

PowerShell is extensible via modules. To learn more about using modules see here.

Mark Wragg
  • 22,105
  • 7
  • 39
  • 68
  • thanks for your response. Actually my requirement is something like this http://ramblingcookiemonster.github.io/Join-Object/ So i am trying to join two dataTables – Harsh Jaswal Nov 02 '17 at 09:24
  • That is what I linked to, I just linked you to the PowerShell Gallery version of his code vs his blog. – Mark Wragg Nov 02 '17 at 09:25
  • @Harsh If you open your mentioned link you will come across a `Join-Object` hyperlink. That contains a version of the `Join-Object.ps1` which @Mark is talking about. – Vivek Kumar Singh Nov 02 '17 at 09:28
2

Looks like it is not a PowerShell cmdlet but rather a function. Check this out. Import this function in your PoSh module and you are good to go.

Vivek Kumar Singh
  • 3,223
  • 1
  • 14
  • 27