mexx991
Goto Top

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!

Content-Key: 319279

Url: https://administrator.de/contentid/319279

Printed on: April 19, 2024 at 19:04 o'clock

Member: Meierjo
Meierjo Oct 27, 2016 updated at 12:08:56 (UTC)
Goto Top
Hallo

Wenn du zb gpresult /r (bei Windows 7) eintippst??
Siehe Computer-Einstellungen
rsop

Gruss
Mitglied: 131301
131301 Oct 27, 2016 updated at 12:53:14 (UTC)
Goto Top
Get-ADComputer

Batch
dsquery computer domainroot -name "%COMPUTERNAME%"  
Powershell
(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)  
VBS
msgbox CreateObject("ADSystemInfo").Computername  
Gruß