PowerShell Cmdlets

I am building a PowerShell script that will upgrade an existing installation of StateServer. I am trying to make it as graceful and robust as possible.
I need a way to remove the host from the store before I uninstall it.

The documentation is vague and references a command (leave_wait) that doesn't seem to exist:
Be sure to wait for the command to fully complete (indicated by an inactive status) prior to restarting the host. Use the leave_wait command instead of this command whenever possible.
I also can't seem to get the commandlets to accept piped input:
Get-Host | Where-Object {$_.HostAddress -eq ""}
Get-Host | Where-Object {$_.IsLocal -eq "True"}

These ignore everything after the pipe.
I got this answer from support:
You can add -Wait $true to the Remove-Host cmdlet to execute a leave_wait. For example, Remove-Host <host_address> -Wait $true

In regards to Get-host, the return type is a collection. i.e. only a single collection object is written to the output stream. So to pipe in the collection, you have to either wrap the Get-host call in parenthesis or assign the return value of Get-host to a variable and then pipe that variable into another command.
For example, you can use the following line to remove a local host:
Remove-Host ((Get-Host) | where-object {$_.IsLocal -eq $true}).HostAddress -Wait $true