Monday, March 24, 2014

VBoxManage modifyhd Code CO_E_SERVER_EXEC_FAILURE (0x80080005) - Server execution failed

This is a lol one. I tried extending the hard disk of a Virtual Machine and received the following error:

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyhd "E:\Virtual Machines\JIRA\Windows Server 2008.vdi" --resize 40960
VBoxManage.exe: error: Failed to create the VirtualBox object!
VBoxManage.exe: error: Code CO_E_SERVER_EXEC_FAILURE (0x80080005) - Server execution failed (extended info not available)
VBoxManage.exe: error: Most likely, the VirtualBox COM server is not running or failed to start.

The Solution


Do *not* start Command Prompt as admin!

Friday, March 21, 2014

Cannot set unknown member 'CompositeTask.PreserveIncompleteTasks'. HTTP headers received from the server

The problem


Today I encountered a strange issue when trying to publish a basic SharePoint 2013 Workflow that has a Start Task Process action in it.


The error I received was the following:

Cannot set unknown member 'CompositeTask.PreserveIncompleteTasks'. HTTP headers received from the server


Microsoft.Workflow.Client.ActivityValidationException: Workflow XAML failed validation due to the following errors:
Cannot set unknown member 'CompositeTask.PreserveIncompleteTasks'. HTTP headers received from the server - ActivityId: 51341428-f7a1-4856-8303-fcbc699335ea. NodeId: SPSRV. Scope: /SharePoint/default/8f0c9dfe-6f01-499c-a356-a417da9b39b4/53d5e7f1-0360-4909-8997-71eaf26b140d. Client ActivityId : a1627f9c-bdfc-80a3-b6fd-cf246a4e8993. ---> System.Net.WebException: The remote server ret


Solution


Checking the logs didn't provide any useful clue. Digging the net I found a post (linked at the bottom) that suggested re-registering the SharePoint 2013 Workflow Service. So I did that.

Register-SPWorkflowService -SPSite https://portal.mydomain.net -WorkflowHostUri https://spsrv:12290 -Force

Question: Will this command affect my currently running workflows?
Answer: No, all workflows will continue running smoothly, even if they are in progress, paused or waiting for an item to change. Tested.


Resources




Monday, March 17, 2014

SharePoint: Are there any Users currently on the site?

Problem


Ever wondered is there anyone connected to the SharePoint Site before doing an iisreset or a server reboot? Or how much the site is used on a daily basis?


Solution


The Performance Monitor tool is just about perfect for this. You can make a custom console, save it and use later. Or you can collect data over time to have a better overview on the server usage (Data Collector Sets section, not covered in this post).



Below I'll detail step by step how to create a custom MMC Console.

  1. First, start a blank mmc console




  2. Add a Performance Monitor Snap-In






  3. You've got a blank Performance Monitor Console. Now you have to add the Counters.



  4. Click on the green Plus Sign and find the following counters:

    Web Service Category
    - Current Anonymous Users
    - Current Non-Anonymous Users

    At the Instances section you can select a particular website or just _Total.



    I also like to add other helpful counters like CPU Usage, Memory, etc. For more info on counters please consult this blog post.


  5. Go to View -> Customize and remove the clutter




  6. Go to File -> Save As and save the console for later use. There you go.


Obviously, you can use this to monitor any kind of IIS Website like TFS, etc.

Tuesday, March 4, 2014

Updating Permissions on List Items via PowerShell

The following script crawls all document libraries from a path of site and looks for *budget*.xls* and will replace all permissions on the Item with Read.
The script is useful to cut access for a pattern of files.

if ((Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null)
{
 Add-PSSnapin Microsoft.SharePoint.PowerShell
}

$site = get-spsite -identity "http://myspportal"

foreach($web in $site.AllWebs)
    {

    if ($web.Url.Contains("http://myspportal/HR/"))     # Look for only under HR
        {

        $Lists = $web.Lists | Where-Object {$_.Title -Like "*Reports*"}   # Pattern to look for in LISTS names
        $roleReadOnly = $web.RoleDefinitions["Read"]

        foreach($list in $lists)
            {
            
             foreach($item in $list.Items | Where-Object {$_.Name -like "*budget*.xls*"})     # Filename pattern is *budget*.xls*
                {
                Write-Host $item.ParentList.ParentWeb.Url+'/'+$item.URL + '      ' + $item.Name
                if ($item.HasUniqueRoleAssignments -eq $false)
                    {
                    $item.BreakRoleInheritance($true);
                    }

                foreach ($ra in $item.RoleAssignments | Where-Object {$_.RoleDefinitionBindings.Name -eq "Contribute" -or $_.RoleDefinitionBindings.Name -eq "Full Control" -or $_.RoleDefinitionBindings.Name -eq "Edit"})
                    {
                        $ra.RoleDefinitionBindings.RemoveAll()
                        $ra.RoleDefinitionBindings.Add($roleReadOnly)
                        $ra.Update()
                    }

                }
            }
        }
    }