Thursday, April 15, 2010

Error 4201: The instance name passed was not recognized as valid by a WMI data provider

I was unable to start the Windows Event Log service on Local Computer. When i tried to start the windows event log service was getting  “Windows could not start the Windows Event Log service on Local Computer.    Error 4201: The instance name passed was not recognized as valid by a WMI data provider.”

This happened at the time of installing MOSS 2007 in my Windows Server 2008 R2 Server machine. Totally i was gone mad coz MOSS 2007 uninstallation crashes due to some reason and was unable to find out the error due to Eventlog crash (what a hell).

Finally figured it out it was due to some permission problem and i had to apply the  SYSTEM user with full control on the folder c:\windows\system32\logfiles\wmi\RTbackup. This solved my problem and the lovely event log was working fine as usual.

more details

Another alternative way is there to renaming the RTBackup file. I didnt try that method hence i have to start the machine in safe mode. It will be a headache at all. so for anyone needs to know about that solution please refer this link.

Wednesday, April 14, 2010

System.IO.FileNotFoundException on "SPSite = new SPSite(url/IP)"

The below code snippet describes the way to insert user profile data into the SharePoint user profile store. At the time of running the code i came across the above said error. I was googling nearly for 1 1/2 days to figure out the problem. I was trying so many options to solve this problem and nothing worked fine. So finally figured it out its due to some permission problem with the application pool. The application pool identity account should be a domain administrator account which has full access (in other words it should be the same identity like the identity account of the MOSS application pool). details

that account should have following permissions:

  1. The account should be a server farm administrator.
  2. The account has permissions to access the content database.
  3. The account is a site collection administrator.
  4. The account  should have permission to access the Windows SharePoint Services site or the SharePoint Server 2007 site through which the code iterates.

by the way when i was reading through some of other blogs they have mentioned its due to 32/64 bit version. i tried that solution too and it didn't work for me. you can read more about this via this link.

string strSharePointSite = @"http://NQ02WBIZWS1";
using (SPSite site = new SPSite(strSharePointSite))
{
    Microsoft.Office.Server.ServerContext context = ServerContext.GetContext(site);
    UserProfileManager profileManager = new UserProfileManager(context);
    UserProfile newUserprofile = null;
    string sAccount = @"domainname\username";
    if (!profileManager.UserExists(sAccount))
    {
        UserProfile profile = profileManager.CreateUserProfile(sAccount);
        if (null == profile)
            textBox1.Text = "Failed to Create User with account :" + sAccount.ToString();
        else
            textBox1.Text = "UserProfileHandler.CalltotheWebService ... User profile created. ...";
    }
    else
    {
        textBox1.Text = "UserProfileHandler.CalltotheWebService ... User profile already exists...";
    }
    newUserprofile = profileManager.GetUserProfile(sAccount);
    newUserprofile[PropertyConstants.Title].Value = "Mr.";
    newUserprofile[PropertyConstants.FirstName].Value = "First Name";
    newUserprofile[PropertyConstants.LastName].Value = "Last Name";
    newUserprofile[PropertyConstants.Department].Value = "IT";
    newUserprofile.Commit();
}

please refer something about access mappings because it will help in some way.

Monday, April 05, 2010

Value cannot be null. Parameter name: serverContext

If you are getting the error “Value cannot be null. Parameter name: serverContext”, as the first step please make sure that you have configured your Shared Services properly and its running.

Thursday, April 01, 2010

New look for MSDN

Seems Microsoft has changed the MSDN look and now it looks nice and loads faster compared to the old one.

image