问题
Trying to list all computers with their OS information that belong to another trusted domain, but OperatingSystem and OperatingSystemVersion returns blank values:
Get-ADComputer -Filter * -Properties Name, OperatingSystem, OperatingSystemVersion -SearchBase "" -Server OtherDomain.com.au:3268 | Format-Table Name, OperatingSystem, OperatingSystemVersion
Only the Name property is populated.
If I run this, it returns alot of info, but the OS info is all blank:
Get-ADComputer -Filter * -Properties * -SearchBase "" -Server OtherDomain.com.au:3268
If I run this command on the "OtherDomain" it works just fine:
Get-ADComputer -Filter * -Properties Name, OperatingSystem, OperatingSystemVersion | Format-Table Name, OperatingSystem, OperatingSystemVersion
I get all 3 information I want. Is there some security issue here that I am encountering when I run it from a different domain? I can browse through Active Directory Users and Computers (dsa.msc) and see the OS information of computers in the other domain without a problem too.
I'm using Powershell 3.0
回答1:
Get-ADComputer -Filter * -Properties Name, OperatingSystem, OperatingSystemVersion -SearchBase "DC=OtherDomain,DC=com,DC=au" -Server "OtherDomain.com.au" | Format-Table Name, OperatingSystem, OperatingSystemVersion
Had to include a value in the Searchbase parameter (cdidn't work with a null value) and remove the port number from the Server parameter value.
来源:https://stackoverflow.com/questions/33498286/powershell-get-adcomputer-from-another-domain-returns-operatingsystem-informati