How to expand parameterizedProperty
Note if you issue the following command:
Get-ADComputer -Filter * |Get-Member
You will get the following result:
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.IDictionaryEnumerator GetEnumerator()
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Item ParameterizedProperty Microsoft.ActiveDirectory.Management.ADPropertyValueCollection Item(string p...
DistinguishedName Property System.String DistinguishedName {get;set;}
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, mscorlib, Version=4.0.0.0, Culture=neutral, ...
SamAccountName Property System.String SamAccountName {get;set;}
SID Property System.Security.Principal.SecurityIdentifier SID {get;set;}
UserPrincipalName Property System.String UserPrincipalName {get;set;}
Notice that property "Item".
So when you type:
Get-ADComputer -Filter * -Property * |Get-Member
You hope tp get something that expands the properties of "Item".
Now. What if you get an error:
PS C:\Data\Scripts> Get-ADComputer -Identity lab17dc1 -property * |gm
Get-ADComputer : One or more properties are invalid.
Parameter name: msDS-AssignedAuthNPolicy
At line:1 char:1
+ Get-ADComputer -Identity lab17dc1 -property * |gm
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (lab17dc1:ADComputer) [Get-ADComputer], ArgumentException
+ FullyQualifiedErrorId : ActiveDirectoryCmdlet:System.ArgumentException,Microsoft.ActiveDirectory.Management.Comm
ands.GetADComputer
Well that is a big Oops. It is actually a bug in AD.
Here is a workaround for THIS bug. To get your properties, do the following:
Get-ADComputer -Identity lab17dc1 |Get-ADObject -properties *|gm
Now you get something like:
TypeName: Microsoft.ActiveDirectory.Management.ADObject
Name MemberType Definition
---- ---------- ----------
Contains Method bool Contains(string propertyName)
Equals Method bool Equals(System.Object obj)
GetEnumerator Method System.Collections.IDictionaryEnumerator GetEnumerator()
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Item ParameterizedProperty Microsoft.ActiveDirectory.Management.ADPropertyValueCollection...
accountExpires Property System.Int64 accountExpires {get;set;}
badPasswordTime Property System.Int64 badPasswordTime {get;set;}
badPwdCount Property System.Int32 badPwdCount {get;set;}
CanonicalName Property System.String CanonicalName {get;}
CN Property System.String CN {get;}
codePage Property System.Int32 codePage {get;set;}
countryCode Property System.Int32 countryCode {get;set;}
Created Property System.DateTime Created {get;}
createTimeStamp Property System.DateTime createTimeStamp {get;}
Deleted Property System.Boolean Deleted {get;}
Description Property System.String Description {get;set;}
DisplayName Property System.String DisplayName {get;set;}
DistinguishedName Property System.String DistinguishedName {get;set;}
dNSHostName Property System.String dNSHostName {get;set;}
dSCorePropagationData Property Microsoft.ActiveDirectory.Management.ADPropertyValueCollection...
instanceType Property System.Int32 instanceType {get;}
isCriticalSystemObject Property System.Boolean isCriticalSystemObject {get;set;}
isDeleted Property System.Boolean isDeleted {get;}
LastKnownParent Property System.String LastKnownParent {get;}
lastLogoff Property System.Int64 lastLogoff {get;set;}
lastLogon Property System.Int64 lastLogon {get;set;}
lastLogonTimestamp Property System.Int64 lastLogonTimestamp {get;set;}
localPolicyFlags Property System.Int32 localPolicyFlags {get;set;}
logonCount Property System.Int32 logonCount {get;set;}
Modified Property System.DateTime Modified {get;}
modifyTimeStamp Property System.DateTime modifyTimeStamp {get;}
msDFSR-ComputerReferenceBL Property Microsoft.ActiveDirectory.Management.ADPropertyValueCollection...
msDS-GenerationId Property System.Byte[] msDS-GenerationId {get;}
msDS-SupportedEncryptionTypes Property System.Int32 msDS-SupportedEncryptionTypes {get;set;}
Name Property System.String Name {get;}
nTSecurityDescriptor Property System.DirectoryServices.ActiveDirectorySecurity nTSecurityDes...
ObjectCategory Property System.String ObjectCategory {get;}
ObjectClass Property System.String ObjectClass {get;set;}
ObjectGUID Property System.Nullable`1[[System.Guid, mscorlib, Version=4.0.0.0, Cul...
objectSid Property System.Security.Principal.SecurityIdentifier objectSid {get;}
operatingSystem Property System.String operatingSystem {get;set;}
operatingSystemVersion Property System.String operatingSystemVersion {get;set;}
primaryGroupID Property System.Int32 primaryGroupID {get;set;}
ProtectedFromAccidentalDeletion Property System.Boolean ProtectedFromAccidentalDeletion {get;set;}
pwdLastSet Property System.Int64 pwdLastSet {get;set;}
rIDSetReferences Property Microsoft.ActiveDirectory.Management.ADPropertyValueCollection...
sAMAccountName Property System.String sAMAccountName {get;set;}
sAMAccountType Property System.Int32 sAMAccountType {get;set;}
sDRightsEffective Property System.Int32 sDRightsEffective {get;}
serverReferenceBL Property Microsoft.ActiveDirectory.Management.ADPropertyValueCollection...
servicePrincipalName Property Microsoft.ActiveDirectory.Management.ADPropertyValueCollection...
userAccountControl Property System.Int32 userAccountControl {get;set;}
uSNChanged Property System.Int64 uSNChanged {get;}
uSNCreated Property System.Int64 uSNCreated {get;}
whenChanged Property System.DateTime whenChanged {get;}
whenCreated Property System.DateTime whenCreated {get;}
Note if you issue the following command:
Get-ADComputer -Filter * |Get-Member
You will get the following result:
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.IDictionaryEnumerator GetEnumerator()
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Item ParameterizedProperty Microsoft.ActiveDirectory.Management.ADPropertyValueCollection Item(string p...
DistinguishedName Property System.String DistinguishedName {get;set;}
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, mscorlib, Version=4.0.0.0, Culture=neutral, ...
SamAccountName Property System.String SamAccountName {get;set;}
SID Property System.Security.Principal.SecurityIdentifier SID {get;set;}
UserPrincipalName Property System.String UserPrincipalName {get;set;}
Notice that property "Item".
So when you type:
Get-ADComputer -Filter * -Property * |Get-Member
You hope tp get something that expands the properties of "Item".
Now. What if you get an error:
PS C:\Data\Scripts> Get-ADComputer -Identity lab17dc1 -property * |gm
Get-ADComputer : One or more properties are invalid.
Parameter name: msDS-AssignedAuthNPolicy
At line:1 char:1
+ Get-ADComputer -Identity lab17dc1 -property * |gm
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (lab17dc1:ADComputer) [Get-ADComputer], ArgumentException
+ FullyQualifiedErrorId : ActiveDirectoryCmdlet:System.ArgumentException,Microsoft.ActiveDirectory.Management.Comm
ands.GetADComputer
Well that is a big Oops. It is actually a bug in AD.
Here is a workaround for THIS bug. To get your properties, do the following:
Get-ADComputer -Identity lab17dc1 |Get-ADObject -properties *|gm
Now you get something like:
TypeName: Microsoft.ActiveDirectory.Management.ADObject
Name MemberType Definition
---- ---------- ----------
Contains Method bool Contains(string propertyName)
Equals Method bool Equals(System.Object obj)
GetEnumerator Method System.Collections.IDictionaryEnumerator GetEnumerator()
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Item ParameterizedProperty Microsoft.ActiveDirectory.Management.ADPropertyValueCollection...
accountExpires Property System.Int64 accountExpires {get;set;}
badPasswordTime Property System.Int64 badPasswordTime {get;set;}
badPwdCount Property System.Int32 badPwdCount {get;set;}
CanonicalName Property System.String CanonicalName {get;}
CN Property System.String CN {get;}
codePage Property System.Int32 codePage {get;set;}
countryCode Property System.Int32 countryCode {get;set;}
Created Property System.DateTime Created {get;}
createTimeStamp Property System.DateTime createTimeStamp {get;}
Deleted Property System.Boolean Deleted {get;}
Description Property System.String Description {get;set;}
DisplayName Property System.String DisplayName {get;set;}
DistinguishedName Property System.String DistinguishedName {get;set;}
dNSHostName Property System.String dNSHostName {get;set;}
dSCorePropagationData Property Microsoft.ActiveDirectory.Management.ADPropertyValueCollection...
instanceType Property System.Int32 instanceType {get;}
isCriticalSystemObject Property System.Boolean isCriticalSystemObject {get;set;}
isDeleted Property System.Boolean isDeleted {get;}
LastKnownParent Property System.String LastKnownParent {get;}
lastLogoff Property System.Int64 lastLogoff {get;set;}
lastLogon Property System.Int64 lastLogon {get;set;}
lastLogonTimestamp Property System.Int64 lastLogonTimestamp {get;set;}
localPolicyFlags Property System.Int32 localPolicyFlags {get;set;}
logonCount Property System.Int32 logonCount {get;set;}
Modified Property System.DateTime Modified {get;}
modifyTimeStamp Property System.DateTime modifyTimeStamp {get;}
msDFSR-ComputerReferenceBL Property Microsoft.ActiveDirectory.Management.ADPropertyValueCollection...
msDS-GenerationId Property System.Byte[] msDS-GenerationId {get;}
msDS-SupportedEncryptionTypes Property System.Int32 msDS-SupportedEncryptionTypes {get;set;}
Name Property System.String Name {get;}
nTSecurityDescriptor Property System.DirectoryServices.ActiveDirectorySecurity nTSecurityDes...
ObjectCategory Property System.String ObjectCategory {get;}
ObjectClass Property System.String ObjectClass {get;set;}
ObjectGUID Property System.Nullable`1[[System.Guid, mscorlib, Version=4.0.0.0, Cul...
objectSid Property System.Security.Principal.SecurityIdentifier objectSid {get;}
operatingSystem Property System.String operatingSystem {get;set;}
operatingSystemVersion Property System.String operatingSystemVersion {get;set;}
primaryGroupID Property System.Int32 primaryGroupID {get;set;}
ProtectedFromAccidentalDeletion Property System.Boolean ProtectedFromAccidentalDeletion {get;set;}
pwdLastSet Property System.Int64 pwdLastSet {get;set;}
rIDSetReferences Property Microsoft.ActiveDirectory.Management.ADPropertyValueCollection...
sAMAccountName Property System.String sAMAccountName {get;set;}
sAMAccountType Property System.Int32 sAMAccountType {get;set;}
sDRightsEffective Property System.Int32 sDRightsEffective {get;}
serverReferenceBL Property Microsoft.ActiveDirectory.Management.ADPropertyValueCollection...
servicePrincipalName Property Microsoft.ActiveDirectory.Management.ADPropertyValueCollection...
userAccountControl Property System.Int32 userAccountControl {get;set;}
uSNChanged Property System.Int64 uSNChanged {get;}
uSNCreated Property System.Int64 uSNCreated {get;}
whenChanged Property System.DateTime whenChanged {get;}
whenCreated Property System.DateTime whenCreated {get;}
Comments
Post a Comment