functions/Start-BitWardenServe.ps1

function Start-BitWardenServe {
<#
.SYNOPSIS
Start-BitWardenServe

.Description
Start a bw serve instance.

.Parameter [String]$Hostname
The hostname to listen the local bw service. Default: 127.0.0.1

.EXAMPLE
Start-BitWardenServe

.NOTES
Name: Start-BitWardenServe
Author: Felix Scholz
Version: 0.0.1.0
DateCreated: 2024-01-29

.LINK
- https://bitwarden.com/de-DE/help/cli/#serve

.COMPONENT
Requires PSEdition Core
Requires Version 7.0 or above
#>

    [CmdletBinding()]
    param(
        [Parameter()]
        [String]$Hostname
    )
    BEGIN {}
    PROCESS {
        $Args = @('--hostname', "$Hostname")

        $process = Start-Process -FilePath "$PSScriptRoot\..\private\bin\bw.exe" -Args $Args -PassThru `
            -NoNewWindow
        Write-Verbose -Message "Open with Id: $( $process.Id ); Handle: $( $process.Handles )"
}
    END {}
}