Sample code for 30+ languages & platforms
PowerShell

Duplicate openssl pkey -in private.pem -pubout -out pubkey.pem

See more OpenSSL Examples

How to output the public part of a private key: Demonstrates how to duplicate this OpenSSL command:
openssl pkey -in private.pem -pubout -out pubkey.pem

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

$pkey = New-Object Chilkat.PrivateKey

# Load the private key from an PEM file:
$success = $pkey.LoadPemFile("private.pem")
if ($success -eq $false) {
    $($pkey.LastErrorText)
    exit
}

$pubKey = New-Object Chilkat.PublicKey
$pkey.ToPublicKey($pubKey)

$success = $pubKey.SavePemFile($false,"pubKey.pem")
if ($success -ne $true) {
    $($pubKey.LastErrorText)

    exit
}

$("Success.")