Tuesday, February 16, 2010
Sunday, May 3, 2009
Business logic and the Entity Framework
I wrote a small article on CodeProject, with a sample project to dabble in. Check it out here: http://www.codeproject.com/KB/linq/entity_interceptors.aspx and let me know if you liked it!
Friday, December 19, 2008
Sharp (#) Problem :)
Hiya all,
my holidays just started... weeeeeeeeeeeeeeeeeeeeeee... and ran head on into a problem with the stupid *.chm files I got myself from work (yeah yeah yeah... holidays and such, I know).
Buuut... none of these things would open, displaying a nasty 'Page cannot be displayed' on the right hand side of the window.
Now there are quite a few solutions to this, of which none worked.. always got that dreaded IE comment about my *.chm... rats.
Though, on a lonely site in the MS databases if found an interesting, yet vital fact... listen up people, there's going to be a test :)
IF the path to the CHM contains a '#' it won't display.
Now imagine my path: 'C:\Data\AD-Migration\C#\Tools\GroupBouncer\Help'... great
Exchanged every occurence of '#' with 'Sharp' (using a quick-hack-prog in CSharp :) ) and BEHOLD THE EMPEROR'S NEW... *looks at scroll again*... errrrr... OLD CHM's!
I hope I at least save somebody's time with this little note... drop me a line... or a beer... well.... thinking that over... AND a beer :)
Regards,
Dirk
Starting to fiddle with LINQ... I think...
my holidays just started... weeeeeeeeeeeeeeeeeeeeeee... and ran head on into a problem with the stupid *.chm files I got myself from work (yeah yeah yeah... holidays and such, I know).
Buuut... none of these things would open, displaying a nasty 'Page cannot be displayed' on the right hand side of the window.
Now there are quite a few solutions to this, of which none worked.. always got that dreaded IE comment about my *.chm... rats.
Though, on a lonely site in the MS databases if found an interesting, yet vital fact... listen up people, there's going to be a test :)
IF the path to the CHM contains a '#' it won't display.
Now imagine my path: 'C:\Data\AD-Migration\C#\Tools\GroupBouncer\Help'... great
Exchanged every occurence of '#' with 'Sharp' (using a quick-hack-prog in CSharp :) ) and BEHOLD THE EMPEROR'S NEW... *looks at scroll again*... errrrr... OLD CHM's!
I hope I at least save somebody's time with this little note... drop me a line... or a beer... well.... thinking that over... AND a beer :)
Regards,
Dirk
Starting to fiddle with LINQ... I think...
Thursday, November 13, 2008
License and Registration, please
As promised the next post is here... this time about checking Groupmembership in a logonscript using VBS.
First of all I have to say this is not the most flexible way of doing it, especially if you have a few different domains to check for, but it should give you a lead on 'how-to'.
I'll just assume you know your programming bits and go on from top to bottom:
Create default objects for Filesystem, Scriptshell and Network. Though I do not need all of them in this one, the main logonscript has all of those in use. So I just included them here too.
Next thing we do is setting up a query for LDAP to our domain where we look for the specific group 'AD-Migration'. All members of that group have to be migrated to the new Domain.
The beauty of this is that you can stuff a new member in there on the On-Site-DC and the change is immideatly done.. no relog.. no gpupdate... just restart the script.
Next step is to interate through all members and see if their current logonname matches the logonname in the group. Next Gotcha... MS calls this 'SamAccountName' in the AD-Schema. And... great praise to whoever dreamed that up... the description in the schema is... *drumroll* 'SamAccountName' DUH...
So... we set a boolean to 'true' if we found the name and start the script(s) accordingly... no magic there...
I hope this did help you a bit on your way... I have some recommended reading though:
Questions welcome :)
See you soon,
Dirk
P.S.:
Yes, actual workingcode directly from our logonscript. I works, honestly!
First of all I have to say this is not the most flexible way of doing it, especially if you have a few different domains to check for, but it should give you a lead on 'how-to'.
- Option Explicit
- On Error Resume Next
- Dim oWS : Set oWS = WScript.CreateObject("WScript.Shell")
- Dim oFS : Set oFS = CreateObject("Scripting.FileSystemObject")
- Dim oWN : Set oWN = CreateObject("Wscript.Network")
- Const ADS_SCOPE_SUBTREE = 2
- Set objConnection = CreateObject("ADODB.Connection")
- Set objCommand = CreateObject("ADODB.Command")
- objConnection.Provider = "ADsDSOObject"
- objConnection.Open "Active Directory Provider"
- Set objCommand.ActiveConnection = objConnection
- objCommand.Properties("Page Size") = 1000
- objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
- objCommand.CommandText = "Select ADsPath, Name From 'LDAP://dc=my,dc=domain,dc=com' Where objectCategory = 'Group' AND Name='AD-Migration'"
- Set objRecordSet = objCommand.Execute
- objRecordSet.MoveFirst
- Set objGroup = GetObject(objRecordSet.Fields("ADsPath").Value)
- Dim UserInGroup
- UserInGroup=False
- For Each strUser in objGroup.Member
- set objUser=GetObject("LDAP://"+struser)
-
- if (LCase(objUser.samaccountname)=LCase(oWN.UserName)) then
- UserInGroup=True
- end if
- Next
- if(UserInGroup=True)then
- oWS.Run("wscript.exe .\AD_UserProfileMigration\migrate_station.vbs")
- else
- Wscript.Quit(0)
- end if
I'll just assume you know your programming bits and go on from top to bottom:
Create default objects for Filesystem, Scriptshell and Network. Though I do not need all of them in this one, the main logonscript has all of those in use. So I just included them here too.
Next thing we do is setting up a query for LDAP to our domain where we look for the specific group 'AD-Migration'. All members of that group have to be migrated to the new Domain.
The beauty of this is that you can stuff a new member in there on the On-Site-DC and the change is immideatly done.. no relog.. no gpupdate... just restart the script.
Next step is to interate through all members and see if their current logonname matches the logonname in the group. Next Gotcha... MS calls this 'SamAccountName' in the AD-Schema. And... great praise to whoever dreamed that up... the description in the schema is... *drumroll* 'SamAccountName' DUH...
So... we set a boolean to 'true' if we found the name and start the script(s) accordingly... no magic there...
I hope this did help you a bit on your way... I have some recommended reading though:
- The windows script Help (v5.6 at the moment). Won't link it here, because it is likely to change in URL. Just search on MS.com.
- Windows Server Support Tools. These bring the 'Active Directory Schema' Add-In for the Managementconsole
Questions welcome :)
See you soon,
Dirk
P.S.:
Yes, actual workingcode directly from our logonscript. I works, honestly!
Thursday, November 6, 2008
Long time no C[++,#]
Busy, busy, busy... and still am :)
Recently we were merging our domain(s) to one, big domain... which is not easy when the impact for the users should be zero (best case that is).
So, what did I learn?
First and foremost VBS *shiver* for the logonscripts and other neato thingies that needed to be done while the user cannot do much about them... which is most important, as these pesky people tend to stop whatever is running just to get to their 'Lotus Notes'.
Second... I did not find a way to make a simple, standalone program to set various (temporary) rights for the users in C#. And I *tried*... HARD... which brought me back to my trusty (and rusty) C++ Builder (I *hate* that registration process thing, Borland! And I *hate* the new help, get the old one back... much niiiicer)
Third... don't trust MS with their docs either... I found a few very *wrong* things they put into the Active Directory Schema docs... well... the Domain will recover :)
What is to expect next from me?
Weeeeeeell... a few posts with tips on what to do and what THE HECK NOT to do in Domainmigration, some neato things I got hopping in VBS (in your *face* Central Team! I *did* get it working, noobs), a neato thing discovered in C# (Yes, Kurt, still fiddling with it and not abandoned) and general riffraff I need to get out :)
There were some questions about me abandoning the blog... yeah... riiiight.
So... I try to post more regularly and keep you updated :)
Recently we were merging our domain(s) to one, big domain... which is not easy when the impact for the users should be zero (best case that is).
So, what did I learn?
First and foremost VBS *shiver* for the logonscripts and other neato thingies that needed to be done while the user cannot do much about them... which is most important, as these pesky people tend to stop whatever is running just to get to their 'Lotus Notes'.
Second... I did not find a way to make a simple, standalone program to set various (temporary) rights for the users in C#. And I *tried*... HARD... which brought me back to my trusty (and rusty) C++ Builder (I *hate* that registration process thing, Borland! And I *hate* the new help, get the old one back... much niiiicer)
Third... don't trust MS with their docs either... I found a few very *wrong* things they put into the Active Directory Schema docs... well... the Domain will recover :)
What is to expect next from me?
Weeeeeeell... a few posts with tips on what to do and what THE HECK NOT to do in Domainmigration, some neato things I got hopping in VBS (in your *face* Central Team! I *did* get it working, noobs), a neato thing discovered in C# (Yes, Kurt, still fiddling with it and not abandoned) and general riffraff I need to get out :)
There were some questions about me abandoning the blog... yeah... riiiight.
So... I try to post more regularly and keep you updated :)
Thursday, August 28, 2008
RSS/ATOM feed extensions made easy
The easiest way to add custom elements to a syndicated (ATOM/RSS feed) is to use an XElement, like this:
SyndicationFeed feed = new SyndicationFeed("FeedName", "Feed description");
//fill feed with items (omitted)
XNamespace ns = "http://tempuri.org/myapp";
feed.ElementExtensions.Add(new XElement(ns + "myCustomProperty", "hello"));
return new Atom10FeedFormatter(feed) // to return as an atom feed
Happy feeding!
SyndicationFeed feed = new SyndicationFeed("FeedName", "Feed description");
//fill feed with items (omitted)
XNamespace ns = "http://tempuri.org/myapp";
feed.ElementExtensions.Add(new XElement(ns + "myCustomProperty", "hello"));
return new Atom10FeedFormatter(feed) // to return as an atom feed
Happy feeding!
Wednesday, August 6, 2008
Subscribe to:
Posts (Atom)