I know nothing about Powershell, but the SQL command you need is:
SELECT suser_sname(owner_sid)
FROM sys.databases d
WHERE d.name = 'DBNAME'
-- OR d.database_id = 'DB_ID';
Use Powershell to execute this command, swapping out DBNAME or DB_ID as you see fit.
EDIT:
Alternatively, the stored-procedure version:
CREATE PROCEDURE checkForSaOwnership ( @dbname VARCHAR(100) )
AS BEGIN
BEGIN TRY
DECLARE @isSA BIT, @dbOwner VARCHAR(100)
SET @dbOwner = (SELECT suser_sname(owner_sid) FROM sys.databases d WHERE d.name = @dbname)
IF (LTRIM(RTRIM(@dbOwner))) = 'sa' BEGIN
RETURN 1 END
ELSE BEGIN
RETURN 0 END
END TRY
BEGIN CATCH
PRINT 'There was a problem executing the procedure. Did you pass in a valid DB name?'
RETURN 0
END CATCH
END
Then from Powershell, set a new variable = EXEC checkForSaOwnership @dbname = 'DBNAME'.
Return value of 1 = yes, owned by SA.
Return value of 0 = no.