Reputation: 152
I have a small PowerShell script, which should show me the operation system of different Servers in the Active Directory. All information are in the computer object, but when I get the reply from the PowerShell script it is empty.
Any ideas what could be the problem?
Script:
Get-ADComputer -Filter {name -like "ServerName"} -Properties 'OperatingSystem', 'OperatingSystemVersion' -Server DomainName:Port
Output:
DistinguishedName : DistinguishedName DNSHostName : DNSHost.domain Enabled : True Name : ServerName ObjectClass : computer ObjectGUID : ObjectGUID OperatingSystem : OperatingSystemVersion : SamAccountName : SAMAccountName$ SID : SSID UserPrincipalName :
Upvotes: 0
Views: 1698
Reputation: 11
as other fields, are not replicated in the Global Catalog (see https://learn.microsoft.com/en-us/windows/win32/adschema/a-operatingsystem and following sections). Hence you can't get these fields when requesting the GC (-Server DomainName:Port). You can retrieve them only by requesting directly the domain (-Server DomainName).
Upvotes: 1
Reputation: 3215
I have exactly the same problem (PS7 with a lot of module), the OperatingSystem parameter is available, but hidden. Nevertheless, filtering on OperatingSystem is possible but not displaying it
Get-ADComputer -Filter { operatingSystem -Like '*Windows Server*'} -Properties operatingSystem -Server $env:USERDNSDOMAIN
result is realy filtered !
DistinguishedName : CN=SRV-01,OU=Serveurs,DC=contoso,DC=com
DNSHostName : SRV-01.contoso.com
Enabled : True
Name : SRV-01
ObjectClass : computer
ObjectGUID : 46306f78-9833-40c2-bb9c-06461462b
OperatingSystem :
SamAccountName : SRV-01$
SID : S-1-5-21-184956565-601246437-303096148-4584
to really know the OperatingSystem value I read the remote registry HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName
Upvotes: 0