Recognize the new Windows Terminal from a PowerShell script
Windows Terminal is still in its infancy and not much to go by to identify it but I noticed that it adds an environment variable WT_SESSION, you might try checking for that:
if ($env:WT_SESSION) { "I am in Windows Terminal"} else { "Nothing to see here..."}
An alternative to the other answer without dependency on environment, you can check the process parent stack for the Terminal executable:
$isTerminal = { $p = Get-CimInstance -ClassName Win32_Process -Filter ProcessID=$PID while ($p) { ($p = Get-CimInstance -ClassName Win32_Process -Filter ProcessID=$($p.ParentProcessID) -ErrorAction Ignore) }}.Invoke().Name -contains 'WindowsTerminal.exe'
This is a method I've used to determine whether I'm in conemu.