Hello All
I am learning more about the ADSI interface, and doing some practice on getting information from the Schema partition
I am having an issue with the systemMustContain or muchContain. the systemMayContain or mayContain works OK
perhaps I am doing something wrong, I know the User object must contain a sAMAccountName which you create it, so I am using this Schema class for my testing (Is this where I am going wrong)
for example, the following for two examples for systemMayContain works fine
example 1
$ClassName = "cn=User"
$RootDSE = [adsi]"LDAP://RootDSE"
$Schema = $RootDSE.schemaNamingContext
$Class = [adsi]"LDAP://$ClassName,$Schema"
$Class.systemMayContain
example 2
$ClassName = "cn=User"
$RootDSE = [adsi]"LDAP://RootDSE"
$Schema = $RootDSE.schemaNamingContext
$Class = [adsi]"LDAP://$ClassName,$Schema"
$Class = $Class.NativeObject
[array]$Array = [System.__ComObject].InvokeMember("systemMayContain",[System.Reflection.BindingFlags]::GetProperty,$null,$Class,$null)
Foreach ($element in $Array) {$element}
However if I change the above systemMayContain for systemMustContain or mustContain I get no error and no results
I also not the intelesense in PowerGUI does not show a systemMustContain property but is does show a systemMayContain property on the User class
I prefer not to use the AD module/s as I feel leaning what is going on under the hood is he best way to learn.
Thanks All
Ernie