Computer OU auslesen bzw. abfragen
Hallo zusammen,
gibt es eine Möglichkeit direkt am Client per Powershell oder CMD-Konsole die OU des Computers abzufragen?
Vielen Dank schon mal!
gibt es eine Möglichkeit direkt am Client per Powershell oder CMD-Konsole die OU des Computers abzufragen?
Vielen Dank schon mal!
Bitte markiere auch die Kommentare, die zur Lösung des Beitrags beigetragen haben
Content-ID: 319279
Url: https://administrator.de/forum/computer-ou-auslesen-bzw-abfragen-319279.html
Ausgedruckt am: 11.04.2025 um 18:04 Uhr
2 Kommentare
Neuester Kommentar

Get-ADComputer
Batch
Powershell
VBS
Gruß
Batch
dsquery computer domainroot -name "%COMPUTERNAME%"
(new-object adsisearcher("LDAP://$(([adsi]'LDAP://rootDSE').defaultNamingContext)","(&(objectCategory=Computer)(Name=$env:Computername))","*",[System.DirectoryServices.SearchScope]::Subtree)).FindOne() | %{$_.Properties['distinguishedName']}
(Get-WmiObject -Namespace 'root\directory\ldap' -Query "Select DS_distinguishedName from DS_computer where DS_cn = '$env:COMPUTERNAME'").DS_distinguishedName
$info = New-Object -ComObject ADSystemInfo
$info.GetType().InvokeMember('Computername','GetProperty',$null,$info,$null)
msgbox CreateObject("ADSystemInfo").Computername