Get-ADComputer OperatingSystem property is missing
Although all the online documentation and examples state there should be an OperatingSystem property for the results of Get-ADComputer I don't have one on my Win Server 2008 R2.
Here is all I have on Get-ADComputer:
PS I:\> Get-ADComputer -filter{name -eq "sit-selpa"} | Get-Member
TypeName: Microsoft.ActiveDirectory.Management.ADComputer
Name MemberType Definition
---- ---------- ----------
Contains Method bool Contains(string propertyName)
Equals Method bool Equals(System.Object obj)
GetEnumerator Method System.Collections.IDictionaryEnumer...
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Item ParameterizedProperty Microsoft.ActiveDirectory.Management...
DistinguishedName Property System.String DistinguishedName {get...
DNSHostName Property System.String DNSHostName {get;set;}
Enabled Property System.Boolean Enabled {get;set;}
Name Property System.String Name {get;}
ObjectClass Property System.String ObjectClass {get;set;}
ObjectGUID Property System.Nullable`1[[System.Guid, msco...
SamAccountName Property System.String SamAccountName {get;set;}
SID Property System.Security.Principal.SecurityId...
UserPrincipalName Property System.String UserPrincipalName {get...
sit-selpa is the Server 2008 R2 server I'm running this on, the localhost.
Why are there only 9 properties? I've searched online but I can't seem to find anyone else with this experience.
Your Get-AdComputer
is only using the default properties for the object. Use the -Properties *
to grab them all:
Get-ADComputer -filter {name -eq "sit-selpa"} -Property * | Get-Member
And then, to just get OperatingSystem
:
Get-ADComputer -filter {name -eq "sit-selpa"} -Property * | Select-Object OperatingSystem
However, you're not required to grab all the object properties using a wildcard. You may specify the additional properties explicitly:
Get-ADComputer -Identity sit-selpa -Properties OperatingSystem
...
Get-ADComputer -Identity sit-selpa -Properties OperatingSystem, OperatingSystemVersion