Script Tips
ADSI Resources
Better ADSI documentation is coming. For now, Microsoft's version will have to do.
A reader writes, "Where can I find a resource that lists the classes available
from the WinNT ADSI provider?"
I do wish ADSI were better documented from a scripting point of view. In fact,
author Cade Fasset is working on ADSI Scripting: TFM (yes, the "TFM"
from "RTFM"!) which should be coming out soon. In the meantime, Microsoft
does have documentation available. Unfortunately, it's meant more for C++ programmers,
so you'll have to kind of squint your eyes for it to make sense, but it'll at
least tell you what types of objects you have to work with. The online docs
can be found here.
Here's how to use them: Let's say you're interested in the FileService class.
Click on IADsFileService to see what it can do. This will list all its properties
and methods.
Want to work with open resources? A note says, "To access active sessions
or open resources used by the file service, you must go through the IADsFileServiceOperations
interface to retrieve sessions or resources." OK, go back one page and
click on IADsFileServiceOperations; you'll see the properties and methods the
file server operations can have, including the Resources collection. Click on
that and you learn that it's a collection of IADsResource interfaces. Sigh.
Click on IADsResources and you'll finally see that open resources have a
name, lock count, path, user, user path and other properties. Hurry up with
that book, Cade.
About the Author
Don Jones is a multiple-year recipient of Microsoft’s MVP Award, and is Curriculum Director for IT Pro Content for video training company Pluralsight. Don is also a co-founder and President of PowerShell.org, a community dedicated to Microsoft’s Windows PowerShell technology. Don has more than two decades of experience in the IT industry, and specializes in the Microsoft business technology platform. He’s the author of more than 50 technology books, an accomplished IT journalist, and a sought-after speaker and instructor at conferences worldwide. Reach Don on Twitter at @concentratedDon, or on Facebook at Facebook.com/ConcentratedDon.