Hi Jan,
you need to call the function, like in the example below:
Please note that the format is not exactly a DN (It begins with LDAP*).
There is a lot simpler way to get the DN of a computer in AD. Please check the example below:
Here is also the code:
$ComputerName=$env:ComputerName
$ComputerDN = (Get-ADComputer -Identity $ComputerName -Properties *).DistinguishedName
Write-Host $ComputerDNS
I hope I was able to help you out!
----------
(If the reply was helpful please don't forget to upvote or accept as answer, thank you)
Regards,
Stoyan