/\/\o\/\/ PowerShelled

This blog has moved to http://ThePowerShellGuy.com Greetings /\/\o\/\/
$AtomFeed = ("Atom.xml")
$PreviousItems = (" Windows MineSweeper cheat "," erroraction on new-item, my Wrong use of Stringbui... "," MSH Minesweeper GUI game "," MSH get-WmiMethodHelp (GWM) Update + format tips. "," More on Cryptograpy and MSH "," Get-credential and Decrypting a SecureString in MSH "," Atari Laptop (no MSH content) "," Sending Mail from MSH "," MSH More replacement script update (HotFix) "," Enhanced More Function for MSH "," ")

Monday, November 21, 2005

 


Monad and Adam (and a preview of my to-be AD provider)



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=en

look 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.asp

and 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\/\/



Comments:
Blogger Sung Meister
that looks quite stunning.
It actually made me so pumped up so that i feel like i should be creating a provider for SQL servers... :)

Would you gimme a pointer on how to get started on creating my own version of MSH provider?
 
Anonymous Anonymous
The PDC (Beta2) docs include the hands-on lab that was done which included writing a provider for Access - writing one for SQL Server wouldn't be very different than the Access provider, so you can use that as a starting point.

http://www.microsoft.com/downloads/details.aspx?FamilyID=8a3c71d1-18e5-49d7-952a-c55d694ecee3&DisplayLang=en
 
Anonymous Anonymous
That looks brilliant. My first thought of the monad provider architecture was - were is the AD provided? Do you have a version to test?

Torsten
 
Blogger /\/\o\/\/
I think the AD provider is a V2 thing,

I also think it's kind a strange as it is launched with Exchange that is using AD to.

I did not have much time to work on my provider yet (basicly it's still the same) still need to handle the path s bit better (OU , DC, CN etc.)

also I don't think I want to return everything, making it more a simple user computer browser.
(performance and the lot of different kinds of properies in AD) guess thats keeping it fromV! to ;-)

but, maybe next weekend, I have some more time, to implement some more ;-)

but I'm merely exploring so don't expect to much of it :-)

gr /\/\o\/\/
 
Anonymous Anonymous
Thanks for your quick response. Next friday I want to show the colleagues of our directory services team some things about monad. Trust me, one of the first questions is: "...and what about a AD or LDAP provider?". Now, I can tell them that someone is working on a small test/sample provider. :))

I think, we have to wait until Exchange 12 release and longer for a real AD provider from MS.

Quote:
"MSFT Kenneth (Expert):
Q: ..."filesystem, registry, function, variable, certificate, alias, environment"; what about AD? Pretty hard to manage Exchange without that?
A: Exchange cmdlets will implicitly manage active directory as required. We will continue to work with AD, WMI and other groups for later releases.

MSFT Kenneth (Expert):
Q: hmmm - no AD (and no Wmi) provider at time of Ex12 release ? Seems a little strange with the Ex melding into AD.
A: Exchange cmdlets will implicitly manage active directory as required. We will continue to work with AD, WMI and other groups for later releases to create desired providers.
"

from: http://www.microsoft.com/technet/community/chats/trans/windowsnet/wnet_120704.mspx

The Q&A is from December 22, 2004. I don't know if they changed their mind.
 
Blogger /\/\o\/\/
Therew are other way's witch make it easy to work with AD from MSH.

try some commands shown here :

http://mow001.blogspot.com/2005/10/ad-infastructure-exploring-with-msh.html

(should impress them, let them do this in VBscript ;-)

Working with Byte-arrays in AD :

http://mow001.blogspot.com/2005/12/get-ad-user-allowed-logonhours-from.html

(you can also write them, PS make the change mentioned here :)

http://mow001.blogspot.com/2005/12/monad-and-more-bytes-with-band-shorter.html

this are also so new things (don't show things on the bottom (b.t.w. is XP problem 2003 will do)

http://mow001.blogspot.com/2005/12/msh-ad-querying-with-net-20-framework.html

also this could be nice :

http://mow001.blogspot.com/2005/12/get-ad-info-into-nested-hashtable-from.html

so there is more to AD in Monad as a provider.

Hope this helps,

gr /\/\o\/\/
 
Anonymous Anonymous
that helps me well. thanks.

Torsten
 
Post a Comment



<< Home

Archives

October 2005   November 2005   December 2005   January 2006   February 2006   March 2006   April 2006   May 2006   June 2006   July 2006   August 2006   September 2006   October 2006   November 2006   December 2006  

$Links = ("PowerShell RC1 Docs"," PowerShell RC1 X86"," PowerShell RC1 X64"," Monad GettingStarted guide"," Monad Progamming Guide"," Monad SDK"," Monad videos on Channel 9"," MSH Community Workspace"," scripts.readify.net "," MonadSource"," www.reskit.net"," PowerShell Blog"," Under The Stairs"," computerperformance powershell Home"," proudlyserving"," MSH on wikipedia"," MSHWiki Channel 9"," Keith Hill's Blog"," Precision Computing"," PowerShell for fun"," MSH Memo (Japanese)"," monadblog")

find-blog -about "PowerShell","Monad" | out-Technorati.
find-blog -contains "","" | out-Technorati.
Google
 
Web mow001.blogspot.com

This page is powered by Blogger. Isn't yours?