Concatenate strings and expression results in PowerShell
'My process id is {0}' -f [System.Diagnostics.Process]::GetCurrentProcess().Id
And if we use automatic variables:
'My process id is {0}' -f $pid
This might be a tad simpler:
$pid
or
"My process id is $pid"
For more info about automatic variables execute:
man about_automatic_variables
Write-Output "My process ID is $([System.Diagnostics.Process]::GetCurrentProcess().Id)"
Basically you just needed to move the closing parenthesis after the Id.