# Powershell toolmaking ebook

**URL:** <https://forums.powershell.org/t/powershell-toolmaking-ebook/21144>\
**Category:** PowerShell Help\
**Created:** [December 13, 2022, 8:01am UTC](https://forums.powershell.org/t/powershell-toolmaking-ebook/21144 "2022-12-13T08:01:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bin](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@bin](https://forums.powershell.org/u/bin)\
**Post date:** [December 13, 2022, 8:01am UTC](https://forums.powershell.org/t/powershell-toolmaking-ebook/21144/1 "2022-12-13T08:01:12Z")

</div>

On the ebook [Learn PowerShell Toolmaking in a Month of Lunches](https://learning.oreilly.com/library/view/learn-powershell-toolmaking/9781617291166/)  
there is a lab in the chapiter 26, with a challenges, Get-Service | Export-TDF c:\services.tdf,  
when i try changing the code in the proxy function with  
`$scriptCmd = { & $wrappedCmd @PSBoundParameters -delimiter "`t"}` ,  
the result is an error when calling the export-tdf proxy function :

```auto
`Exception calling "GetSteppablePipeline" with "1" argument(s): "The expression after '&' in a pipeline element produced an object that was not valid.It must result in a 
command name, a script block, or a CommandInfo object"

```

have an idea ? thank you

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [December 13, 2022, 8:08am UTC](https://forums.powershell.org/t/powershell-toolmaking-ebook/21144/2 "2022-12-13T08:08:07Z")

</div>

harry,  
Welcome to the forum. 👋🏽

Before we proceed … When you post code, sample data, console output or error messages please format it as code using the _preformatted text_ button ( **\</\>** ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

[How to format code in PowerShell.org](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/b/bee50c628238f2c076c0504efb6b15f2fb11f002.gif) \<---- Click 👆🏽 😉

Since not all of us have access to that book or have read it already … could you please share at least all the _relevant_ code here completely along with the complete error message (both formatted as code, please)?

Thanks

---

<div class="post-metadata">

**Author:** ![bin](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@bin](https://forums.powershell.org/u/bin)\
**Post date:** [December 13, 2022, 10:07am UTC](https://forums.powershell.org/t/powershell-toolmaking-ebook/21144/3 "2022-12-13T10:07:57Z")

</div>

Excuse me , i will proceed with the formating as required

---

<div class="post-metadata">

**Author:** ![bin](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@bin](https://forums.powershell.org/u/bin)\
**Post date:** [December 13, 2022, 11:13am UTC](https://forums.powershell.org/t/powershell-toolmaking-ebook/21144/4 "2022-12-13T11:13:16Z")

</div>

this is the source code

```auto
#proxy function
<#
First, we need to run these lines to create the metadata:
$metadata = New-Object System.Management.Automation.CommandMetaData (Get-Command Export-CSV)
Chapter 26 lab 83
[System.Management.Automation.ProxyCommand]::Create($metadata) | Out-File ProxyExportCSV.ps1
#>
Function Export-TDF {
#we deleted the help link in cmdletbinding and added our own
<#
.Synopsis
Export to tab delimited file
.Description
This is a proxy command to Export-CSV which is hard coded to export
data to a tab-delimited file.
#>
[CmdletBinding(DefaultParameterSetName='Delimiter',SupportsShouldProcess=$true,ConfirmImpact='Medium')]
param(
 [Parameter(Mandatory=$true, ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
 [psobject]
 ${InputObject},
 [Parameter(Position=0)]
 [ValidateNotNullOrEmpty()]
 [string]
 ${Path},
 [Alias('PSPath')]
 [ValidateNotNullOrEmpty()]
 [string]
 ${LiteralPath},
 [switch]
 ${Force},
 [Alias('NoOverwrite')]
 [switch]
 ${NoClobber},
[ValidateSet('Unicode','UTF7','UTF8','ASCII','UTF32','BigEndianUnicode','Default','OEM')]
 [string]
 ${Encoding},
 [switch]
 ${Append},
 #we deleted the Delimiter parameter that used to be here
 [Parameter(ParameterSetName='UseCulture')]
 [switch]
 ${UseCulture},
 [Alias('NTI')]
 [switch]
 ${NoTypeInformation})

begin
{
 try {
 $outBuffer = $null
 if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer))
 {
 $PSBoundParameters['OutBuffer'] = 1
 }
 $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('ExportCsv', [System.Management.Automation.CommandTypes]::Cmdlet)
 <#
 we added a hard coded reference to include the original -delimiter parameter
 with the tab character.
 #>
 $scriptCmd = { & $wrappedCmd @PSBoundParameters -delimiter "`t"}
 $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin)
 $steppablePipeline.Begin($PSCmdlet)
 } catch {
 throw
 }
}
process
{
 try {
 $steppablePipeline.Process($_)
 } catch {
 throw
 }
}
end
{
 try {
 $steppablePipeline.End()
 } catch {
 throw
 }
}
#We deleted the links for forwarded help
} #end function
#test it out
Get-Service -Name winrm | Export-TDF c:\services.tdf

```

---

<div class="post-metadata">

**Author:** ![matt-bloomfield](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@matt-bloomfield](https://forums.powershell.org/u/matt-bloomfield)\
**Post date:** [December 13, 2022, 9:40pm UTC](https://forums.powershell.org/t/powershell-toolmaking-ebook/21144/5 "2022-12-13T21:40:09Z")

</div>

You have a typo in your code, you’re missing the `-` in `Export-Csv`

So this:

```auto
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('ExportCsv', [System.Management.Automation.CommandTypes]::Cmdlet)

```

Should be:

```auto
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Export-Csv', [System.Management.Automation.CommandTypes]::Cmdlet)

```

---

<div class="post-metadata">

**Author:** ![bin](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@bin](https://forums.powershell.org/u/bin)\
**Post date:** [December 14, 2022, 12:03pm UTC](https://forums.powershell.org/t/powershell-toolmaking-ebook/21144/6 "2022-12-14T12:03:58Z")

</div>

> [@bin](#):
>
> Get-Service | Export-TDF c:\services.tdf

where are my glasses , thank you very very much

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:16pm UTC](https://forums.powershell.org/t/powershell-toolmaking-ebook/21144/7 "2024-05-16T20:16:15Z")

</div>

Closed on May 16, 2024, 8:16pm UTC


