Welcome!
Take a look at Test-Connection and Resolve-DNSName. Resolve-DNSName can do reverse lookups.
Docs:
- Resolve-DnsName (DnsClient) | Microsoft Learn
- Test-Connection (Microsoft.PowerShell.Management) - PowerShell | Microsoft Learn
Something like this should do the trick, but you may need to slightly tweak for your needs.
$Connection = Test-Connection -TargetName WRKSTN101.mydomain.com -Ping -Count 1
$DNS = Resolve-DNSName -Name $Connection.DisplayAddress
#$DNS will be a object that has multiple properties, probably the one you care about is the NameHost property
$DNS.NameHost