so i have been seeing the .psbase thing in posh scripts and blindly using it because it works in the scripts that seem to need it but understand what it is and why it is used?????
i finally read Tobias' 'ADSI Connecting to Domains/Computers and Binding to Objects' where he does a nice job of explaining .psbase and why you use it
in fact his MASTERING POWERSHELL IN YOUR LUNCH BREAK: series is well worth your time
what i think i have learned is that you use .pbase when you need more information than is provided by get-member you need to do this because the info provided by get-member is sometimes filtered by posh
here some examples from dat 6
$domain get-member
$domain.psbase get-member
$computer get-member
$computer.psbase get-member
$domain = [ADSI]" "
$domain.psbase.children % {
"Name: " + $_.name
"DistinguishedName: " + $_.distinguishedName
"Class: " + $_.objectClass[$_.objectClass.count -1]
"========================================"
}
bottom line when i run an object through get-member and don't see what i am looking for i'll do that object.psbase thing before posting a ?
thanks tobias
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment