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!
Please also mark the comments that contributed to the solution of the article
Content-Key: 319279
Url: https://administrator.de/contentid/319279
Printed on: May 3, 2024 at 00:05 o'clock
2 Comments
Latest comment
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