April 21, 2008 - 16:39, by Robin Meure
Today I was asked to change some text to the email that is being sent to the users who's password is about to expire. Now being the quick & dirty developer that I was (.. really.. I'm a professional now), this line of text is hard coded in the source. So I had to open my old solution file and came to the discovery that this piece of code was still based on Password Reminder updated! and not utilizing the new features of .NET 3.5 where we have some actual AD support in the DirectoryServices namespace. Therefore I decided to update this solution to make use of it so here it is. The best part is that it cleans my code up quite drastically as well!
Instead of this :
DirectoryEntry entry = new DirectoryEntry("LDAP://domain.com");
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + LogUser + ")";
SearchResult LDAPresult = search.FindOne();
entry = LDAPresult.GetDirectoryEntry();
// Pulling the informtion on when the password was last changed and converting it to a LargeInteger.
LargeInteger liAcctPwdChange = entry.Properties["pwdLastSet"].Value as LargeInteger;
// Convert the highorder/loworder parts of the property pulled to a long.
long dateAcctPwdChange = (((long)(liAcctPwdChange.HighPart) << 32) + (long)liAcctPwdChange.LowPart);
// Convert FileTime to DateTime and get what today's date is.
DateTime dtNow = DateTime.Now;
// I added 180 days because I know what my password expiration is set to, if not you need to pull that information and add the number of days it is set for.
CultureInfo ci = new CultureInfo("nl-NL");
DateTime dtAcctPwdChange = DateTime.FromFileTime(dateAcctPwdChange).AddDays(180);
string strAcctPwdChange = DateTime.FromFileTime(dateAcctPwdChange).ToString("d",ci);
string strAcctPwdExpires = DateTime.FromFileTime(dateAcctPwdChange).AddDays(180).ToString("d",ci);
// Calculate the difference between the date the pasword was changed, and what day it is now and display the # of days.
TimeSpan time;
time = dtAcctPwdChange - dtNow;
if (time.Days < 20 && time.Days >= 0)
{
if (Convert.ToInt32(entry.Properties["userAccountControl"].Value.ToString() == 544))
{
}
}
We now have this :
PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "DOMAIN", "DC=DOMAIN,DC=COM");
DateTime dt = DateTime.Today;
PrincipalSearchResult<UserPrincipal> results = UserPrincipal.FindByPasswordSetTime(ctx, dt.AddDays(-160), MatchType.LessThanOrEquals);
foreach (UserPrincipal result in results)
{
if ((bool)result.Enabled)
{
}
}
Pretty good stuff eh? ;)
April 21, 2008 - 08:37, by Robin Meure
The very first zevenseas solution by my mate Daniel is publicly available as a beta for you to download. Now let me indulge you in the history of the solution.. First of all it was called ShareMark and while the name isn't that bad, it was not meant to actually share Mark but rather a bookmark. So hence the name "Tagged Links" ;) Secondly it got Daniel to learn C# and leaving his beloved VB.NET behind him (still amazed me that even working at Microsoft you could get away only knowing VB ;). And thirdly, like I said in the beginning of the post, this is the first real solution of zevenseas! Expect more (elegant, flexible, dreamy, topnotch, etc) solutions coming from us ;)
Check out the following posts to see what Tagged Links is all about :
Introducing the Tagged Links Solution (beta) Social Bookmarking for SharePoint
Tagged Links Walk-through
btw.. the thing that impressed me most was the view with the statistics and the tagcloud (as seen in the image below)

April 19, 2008 - 11:52, by Robin Meure
While patching an environment with SP1 I was stumbled by the fact that it took a really long time to complete the patch process. So I opened up the upgrade.log file (which you can find in the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS folder). And there a hour long the following line was written :
[SPManager] [DEBUG] [4/19/2008 10:51:53 AM]: SyncUpgradeTimerJob: sleeping for 10 seconds
So I fired up Google and found the following post by Bill Bear : KB934525 Troubleshooting "Cannot start service SPAdmin on computer '.'." , now the answer was not directly found in the post but in the comments section where Chris Fields had the same problem I had. His problem was the following :
We noticed that in our from dev and stage farms this message was only logged for a minute or two before the upgrade process proceeded. We also noticed that the upgrade had stopped the sptimerv3 service but we had an automated MOM rule that had restarted it. We simply stopped sptimerv3 for a few minutes then re-started it. Within 5 minutes the upgrade had proceeded passed the sleeping phase and was upgrading databases. It completed successfully.
Acting on his solution I also restarted the SPTimer job, but didn't succeed to eliminate the the logging of the 'sleeping for 10 seconds' event. What I did next was to restart the SPAdmin service and after that restart the patch process happily continued and the environment had SP1 on it ;)
April 17, 2008 - 13:27, by Robin Meure
While testing the installation of SP1 on our new environment having four front-end servers the error "The installation of this package failed' popped up on two servers. Being the Google fanatic that I am, I found a KB article that explained the error and the error was related to having not enough space available. So I checked the space available and I had >5gb of storage available on the system drive so this was, as you may have guessed, not the problem. I opened up the eventviewer of the servers and find the following errors :
Event Type: Error
Event Source: Service Control Manager
Event Category: None
Event ID: 7024
Date: 4/17/2008
Time: 12:37:26 PM
User: N/A
Computer: webserver1
Description:
The IIS Admin Service service terminated with service-specific error 2149648394 (0x8021080A).
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Event Type: Error
Event Source: IIS Config
Event Category: Catalog
Event ID: 4275
Date: 4/17/2008
Time: 12:37:26 PM
User: N/A
Computer: webserver1
Description:
Error parsing XML file. Reason: An invalid character was found in text content.
Incorrect XML:
ErrorCode : 0xC00CE508
Interceptor : 14
OperationType : Populate
Table : MBProperty
ConfigurationSource : file:///C:/WINDOWS/system32/inetsrv/MetaBase.xml
Row : 0
Column : 0
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
So next thing to Google was the "The IIS Admin Service service terminated with service-specific error 2149648394 " error! And luckily the first hit was The IIS Admin Service service terminated with service-specific error 2149648394 (0x8021080A). by Mike Hamilton ;) Strangely enough I wasn't the only with the same symptoms and problems and it was all related to the SP1 upgrade:
Interstingly, during that reboot - which for all intents should have gone fine - I see a hoard of DSKCHK processes running. Invariably, something got out of wack on the NTFS volumn between my shutting the image down and bringing it back up. During the 'fixing' process - a number of files invaribly can become corrupt - and the Metabase.xml - the blood-life of your IIS Admin service - is no exception.
Hope this helps someone ;)
April 2, 2008 - 11:42, by Robin Meure
So in addition to my 'get to know Robin better by reading his movie & xbox blog'-post, I now need to expose eight facts about myself because Bart Wessels has tagged me.. ;)
Well here goes :
- I once had the dream of becoming a (house) dj, but I'm afraid that dream will never come true so I will just spin my records at home having my girlfriend and cat as an audience ;) If you're interested in my mixes just ping me and I will put some online! (maybe the SharePoint community (yes.. that means YOU :) can boost my dj popularity))
- On my last holiday in Egypt I got my PADI Open Water certification!
- I'm addicted to PES2008 on the XBOX360.. and I'm planning to buy the Wii version as well! ;)
- My favorite movie of all time is "Spies Like Us" starring Dan Akroyd and Chevy Chase.
- My second favorite movie of all time is "Donnie Darko" (directors cut) and the "Three Amigos" and "The Producers (2005)" come in very close as 3rd and 4th
- I live in the most unattractive city (which is Nieuwegein) in the Netherlands from an 'authentic' point of view but it's so practical and functional that I love it (all the three major highways of the Netherlands (A2/A12/A27) are within 5mins range)
- Next to diving, skiing is one of my favorite holiday things to do. Although the last three years I didn't go, this year I went and it was yet again just awesome! :) I really like the feeling of being busy the whole day, spending the day outdoor (and that coming from a geek eh?) then having some drinks and go to bed early :) When I came home this year from skiing it felt like I was gone for about a month while the trip 'only' lasted for a week.. Highly recommended!
- I actually enjoy going to IKEA..
And as the tradition goes.. I have to tag other bloggers so here goes !