This blog has moved to http://ThePowerShellGuy.com
Greetings /\/\o\/\/
As Martin Zuguc told me that a WMI provider was show at the IT Forum by JS.
and I had looked at the PDC Provider walkthrough once again, thinking about WMI. I decided to put myself at a AD provider.
First I finally uninstalled all .NET beta stuff (I did want to do a reinstall first.. but it was keeping me to long) as MSH had messed up all my VS'es except the VS2002 , that I convinced my manager, I needed as an Admin-tool at the time ;-)
the great $50 version, made that possible. (b.t.w. I think my Euro calculator is broken as it was 100 Euro here ;-)) , but anyway cheap enough to convince my manager at the time. So you can imagine how glad I was with the VS2005 express prices ;-)
but OK, after installing a big list of beta .net stuff of my puter, downloading the C# -ISO , rebooting, I could not mount the Image, ok then I will burn it, … all my CD drives gone also, and a failing CDrom driver message in my eventlog.
After SP2 HF’s and rebooting, some google-ing… and I removed the upperfilter from the registry (just removing and redetect devices did not work), another reboot, my drives back and I could burn my image (mount proggy uninstalled in the process of Troubleshooting. )
Re-installed Monad and ready to go.
But to get back to the topic, to make an AD provider I needed an AD ….
Oops /\/\o\/\/ NO have…!VPC beta ?.. hmm, …….(remembering a scripting guy’s article) …. Adam !
So there we go ..
Download ADAM :
http://www.microsoft.com/downloads/details.aspx?FamilyId=9688F8B9-1034-4EF6-A3E5-2A2A57B5C8E4&displaylang=enlook up the Article : (do before install, I did it later, leading to twice installing ADAM ;-)) yes, even better as I did remember, exactly what I needed !!
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnclinic/html/scripting01132004.aspand we are ready to make are own testing AD for MSH ;-)
I made my instance mow and the DN “DC=Mow,DC=Adam” but you can mimic your own AD structure in ADAM.
I made the following script to make a start to the AD structure I needed for testing my “soon-to-be” provider.
The script looks like this :
$de = new-object system.directoryservices.directoryentry("LDAP://localhost:389/dc=mow,dc=adam")
$ou = $de.invoke("Create",("organizationalUnit", "ou=MowOu"))
$ou.invoke("setinfo")
$ou = $de.invoke("Create",("container", "cn=Users"))
$ou.invoke("setinfo")
$ou = new-object system.directoryservices.directoryentry("LDAP://localhost:389/ou=mowOu,dc=mow,dc=adam")
$user = $ou.invoke("Create",("user","cn=mow"))
$user.invoke("Put",("displayName","mow"))
$user.invoke("setinfo")
I almost exactly copied this of the article, so I would like to point you there for more information (also a group example, but all basicly the Same)
b.t.w you can't use the nice .NET 2.0 ActiveDirectoryClasses for connecting to ADAM as with a domain like I showed here :
AD Infastructure exploring with MSH , to connect, but I think you can set a "default naming context" somewhere.
And now we are set, and do some testing in AD stuff in Monad without a Domain
As now I can go on to the AD-provider part it started with, I already did a part, in C# and the refactoring . help was great as I started with the template from the PDC walktrough (some more info below the sample).
so have fun with Monad and Adam ;-)
Gr. /\/\o\/\/
I got My AD provider already Partly working
The current status of my provider :
MSH H:\> new-drive ad mowadp "LDAP://localhost:389/dc=mow,dc=adam"
Name Provider Root CurrentLocation
---- -------- ---- ---------------
ad mowadp LDAP://DC=MOW,DC=ADAM
MSH H:\> cd ad:
MSH ad:\> ls
distinguishedName
-----------------
{OU=MowOu,DC=MOW,DC=ADAM}
{CN=Computers,DC=MOW,DC=ADAM}
{CN=Users,DC=MOW,DC=ADAM}
…
MSH ad:\> gi .
distinguishedName
-----------------
{DC=MOW,DC=ADAM}
Now I need to translate it to \mowou\users..
but I could not use the template on that because of the different structure,so I did delete all the path-helper methods from the example to clear it up a bit,(keep them on paper for reference).
Now I have to reimplement them to do my own parsing(but than again .... $regEx will do that for me lol.)also I'm just outputting the DirectoryEntry yet, I will need to wrap it also.but first needed to clean up as it was to different from the DB sample.
As I think looks nice already
(if you keep the demo small enough)…i'm just started,
But keep you posted ;-)
Second greetings /\/\o\/\/