Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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
share|improve this answer
    
This is exactly what I was looking for! Thanks! It's amazing I couldn't easily find an answer on Google. Now that you let me know about -Properties * I do see it in use, but never with an explanation. Now there will be one. :) –  Matt Penner Apr 15 '11 at 16:00
    
@Matt Check out the Get-Help in combo with -detailed or -full. It can be used to get the gory details on most everything. Get-Help Get-ADComputer -full | more then look for the Properties section. –  jscott Apr 15 '11 at 16:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.