Current user is not a farm administrator - redux

A while ago, I posted about an issue with deploying a custom SharePoint retention policy where activating a feature was failing due to a permissions issue.

I fell over this issue again recently, but despite following all the advice in that post, I still couldn’t get things to activate and I didn’t really want to start giving all known service accounts local admin and DBO on everything in sight. So instead, I used a quick Powershell workaround. This works because PS always runs in the context of the Farm Admin, so I assumed it must have the relevant permissions. This script will find the feature you want to activate, and then activate it. Success is no message returned!

Read more

The OLE DB provider Microsoft.Ace.OLEDB.12.0 for linked server (null) reported an error. Access denied.

I’m noting this here primarily because I’m almost certain to trip over this again in the future. If you want to use the ACE or JET providers to read an e.g., Excel spreadsheet to an e.g., SQL Server table, then something like this is possible. Assuming you had a simple Excel workbook (Book1.xlsx) and in Sheet1 you had

Col1 Col2
Test Test2

You could use this to load it:

SELECT * INTO #tmpTable FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0 Xml;HDR=YES;Database=C:TempBook1.xlsx','SELECT * FROM [Sheet1$]')<br /> GO<br /> SELECT * from #tmpTable<br />

Read more

Auto generate SQL audit tables and database triggers

One approach to monitoring version history of items in SQL tables is to use an _Audit table version with database triggers. However, the creation and maintenance of the tables and triggers can be time consuming. This post provided a nice script to automate the creation but unfortunately it suffered a few issues. In the comments, someone posted a sproc version of the script - but unfortunately this was also broken.

So I have tidied it up and fixed the issues. My host doesn’t let me post SQL in these posts, so you can view the file here.

Read more

SharePoint Designer 2010 - list/library There are no items to show in this view - ListData.svc woes

This is one of those SharePoint errors. You know the ones.

Background

I was trying to use SharePoint Designer to customise a list. I opened up SharePoint Designer, and, although I could connect to the site itself, when clicking on the lists/libraries folder, you get a message saying:

“There are no items to show in this view”.

Weird. I tried this on various other web applications (even on the same server) and everything was working fine.

Read more

SharePoint 2010 - Managed Metadata - Required feature is not enabled for this column type

Quick tip: if you’re using the Managed Metadata service in SharePoint 2010, you may encounter an issue when trying to use it in a site column. When creating the column of type, Managed Metadata, you may encounter the error message:

Required feature is not enabled for this column type

This is simple to fix. In powershell, issue

get-spfeature | where {$_.DisplayName -eq 'TaxonomyFieldAdded'} | enable-spfeature -url http://yoursiteurl

changing the -url paramater to match the URL of your site. Job done.

Read more

Some notes on VMWare Converter

VMWare converter is a free tool from VMWare to convert Virtual Machines from one format to another. I’ve recently built an ESXi server and was looking to move some machines from VMWare Fusion 5 over to it. There are a few pitfalls to be aware of:

  1. VMWare Converter 5.0 is not compatible with ESXi 5.1 (yet). Don’t even try - Converter will just hang.
  2. Converter 4.3 is allegedly compatible with 5.1, but I didn’t have any success. I would get “invalid fault” exceptions.
  3. Convert 5.0 with ESXi 5.0U1 is painfully slow to transfer machines, even on gigabit lan. There is one option here that explains how to improve conditions. However, even with that fix, I only got transfer speeds of around 5mb/s when transferring file-based VMs.
  4. It may not help, but check DNS and network config between you and your ESXi server is setup. DNS in my ESXi was set up to be some random IP address which presumably did not help.
  5. Installing the converter on the machine you want to transfer is much faster. So rather than targetting a .vmx file, you can tell it to transfer the “currently powered-on machine”. Doing this with a simple W7 machine achieved speeds of anywhere up to 14mb/s. (Not great if you want to transfer a non-Windows machine, though!)
  6. You may encounter issues with VMs that have multiple virtual hard drives. I had a SQL Server with 3 separate drives installed, and whilst it did transfer all drives, with data intact, only the C: drive was alive when starting the machine. You may need to use DISKPART to get the other drives going again.

Will add more issues as I encounter them.

Read more

My VMWare ESXi build - Part 2 - Building ESXi

This is the second post in a series about running ESXi on a home server. See the first part, here.

ESXi is a free download from VMWare. You just need to register an account and install it. Simple huh? Well, not all the way. Two main issues:

  1. I didn’t install an optical drive (intentionally, although with hindsight it would have been a bit easier to have one)
  2. The Broadcam NetXtreme BCM57781 LAN card on my ASROCK board is not supported by ESXi. D’oh.

However, there are ways around this. If you’re running the same build as me, you should be able to follow these steps. If you’re using different hardware, substitute in the relevant bits!

Read more

My VMWare ESXi 5.1 build - Part 1 - The Hardware

This is the first part of a series on running ESXi on a home server. See the second part, here.

It’s a been a while since updating this blog. Apologies, but it’s mostly because I’ve been really busy. As part of that though, I use a lot of VMWare Virtual Machines. Being an Apple “fanboy” (gah) I use VMWare Fusion on my Macs which is great for running various virtual machines. (In fact, Windows 7 and Windows Server 2008 R2 seem to run a hell of a lot better virtualised rather than natively. Go figure.)

Anyway, it got to a point where I decided I needed a bigger and more robust framework to run virtual machines on. Simply speaking, running one or two VMs on my Mac is fine, but when you need to run several at one time with limited resources, it starts to get a lot more involved. Given that VMWare ESXi Hypervisor is a free platform for running a single server VM host, I figured I’d experiment with building an ESXi server for home use. This blog post details some of the pain I went through in getting there.

Before I get started, there are a few terms I will use:

HOST - the physical machine, that is running ESXi
GUEST (or guest OS) - this is the virtual machine(s) that then runs on ESXi

And quickly:

What is ESXi

ESXi is a cut down linux kernel that acts as a hypervisor. That is, it’s a piece of software that runs on the physical machine, and then presents the physical hardware to the guest machines that want to use it. It in itself is not an OS. So they key difference here between say VMWare Fusion or Workstation is that you’re not running an edition of e.g., Windows Server which itself is running Virtual Machines - you’re, moreorless, cutting out the middle man.

Read more

SharePoint 2010 State Machine workflow delayActivity tip

If you’re using a delayActivity in your Visual Studio State Machine workflow, you are likely to want to use the InitializeTimeoutDuration handler to set the length of the delay.

An easy mistake to make is to think you could do the following:

private void DelayActivity_InitializeTimeoutDuration(object sender, EventArgs e)
        {
            delayActivity1.TimeoutDuration = new TimeSpan(0, 10, 0);
        }

However, this won’t work. This is because SharePoint will intialise a new instance of the delayActivity with the timeoutduration specified as default. To set the TimeoutDuration of your “actual” activity, you should do the following:

Read more

SharePoint 2010 State Machine workflow onWorkflowItemChanged firing multiple times

If you’re designing a SharePoint 2010 workflow, particularly a state machine, you may base the workflow activities around an item in a list. Particularly, you may want the workflow to carry out activities when the item is changed by the end user.

This is a relatively straight-forward task, but one thing you will quickly encounter is that if you have multiple states, and each one handling the onWorkflowItemChanged event, you’ll notice that the event will fire once for each occurrence of your handler. So if you had 3 states, and each one has an onWorkflowItemChanged event, then your state that is handling the event will receive it 3 times. This is clearly undesirable and quite frankly strange behaviour.

Read more