Skip to content

Month: May 2014

Add Local Administrators as SQL Server Administrator using PowerShell

Ever faced a situation when you are stuck with a SQL Server when you don’t have access even though if you are the Local Administrator.

Luckily, there is a way to get yourself access in this situation and you can use the following script.

It uses the SQL Server Single-User Mode to start the SQL Server. Starting SQL Server in single-user mode enables any member of the computer’s local Administrators group to connect to the instance of SQL Server as a member of the sysadmin fixed server role. For more information, see Connect to SQL Server When System Administrators Are Locked Out.

Download Script


$ServiceName = "MSSQLSERVER" #Enter the service name for your SQL Server Instance (MSSQLSERVER by default)
$Server = "Manas" #Enter the name of SQL Server Instance

NET STOP $ServiceName 
NET START $ServiceName /mSQLCMD 

SQLCMD -S $Server -Q "if not exists(select * from sys.server_principals where name='BUILTIN\administrators') CREATE LOGIN [BUILTIN\administrators] FROM WINDOWS;EXEC master..sp_addsrvrolemember @loginame = N'BUILTIN\administrators', @rolename = N'sysadmin'" 

NET STOP $ServiceName 
NET START $ServiceName

SQLCMD -S $Server -Q "if exists( select * from fn_my_permissions(NULL, 'SERVER') where permission_name = 'CONTROL SERVER') print 'You are a sysadmin.'" 

An introduction to Action Learning Cycle

Conceptually, the action learning cycle (Figure: The action Learning Cycle) consists of four phases (Zuber-Skerritt, 2000).
051114_1205_Anintroduct1.png
The first phase of the cycle is to identify the problem which is relevant and is in the power of group to solve. It should be evident that the problem should be complex in nature and no opportunity for solution is readily available. Next, the group starts with the discussion with a intention to solve the problem. The questions rather than the individuals are given utmost importance, facilitating possible solution for the problem. Third, the group identifies the possible solution and implements it. In the final phase, the group looks back at the implemented solution and evaluates it.
(Marquardt, 1999) in his book ‘Action learning in action’, describes what he defines as the six key elements of action learning.

  1. A problem (project, challenge, opportunity, issue or task)
  2. An action learning group or team
  3. A process that emphasizes insightful questioning and reflective listening
  4. A resolution of taking action
  5. A commitment to learning
  6. A group facilitator

To fit the above elements in the action learning cycles, it could be considered that an action learning group/team tries to solve a problem (project, challenge) through a process of asking insightful questions and reflective listening. They identify an action and take a resolution to act upon it with a commitment to learning.
(Mumford, 1995) proposes the following essential elements for action learning:

  1. Learning should mean learning to take effective action
  2. Learning to take effective action involves actually taking action not just recommending action
  3. The action learning project must be significant to the learners themselves
  4. Learners learn best from one another

Running a 32 bit web application in IIS 8 with SharePoint 2013

By default, IIS running on a 64 bit computer does not support running a 32 bit application. However, you can change the setting in an Application Pool under which the application is running by setting the ‘Enable 32-bit Applications‘ to true. Or you can use the enable32BitAppOnWin64 to enable the 32 bit web applications on IIS running on a 64 bit computer.

IIS 32 bit application

Sounds simple enough. As per documentation, I created a new web-site in IIS and change the application pool to enable 32-bit application. Big deal!

Well, not so soon. I noticed that when I tried to visit the application it gives me HTTP Error 503. The service is unavailable. error.

IIS 32 bit application Error 503. The service is unavailable.

Considering that it might have been one time hick-up, I restarted the IIS and tried again. No luck and what I noticed that the application pool was stopped repeatedly as soon as I access the application. Checking the event logs showed the following error:

The Module DLL ‘C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\isapi\spnativerequestmodule.dll’ could not be loaded due to a configuration problem. The current configuration only supports loading images built for a x86 processor architecture. The data field contains the error number. To learn more about this issue, including how to troubleshooting this kind of processor architecture mismatch error, see http://go.microsoft.com/fwlink/?LinkId=29349.

Strange! This was a new application I created and had nothing to do with SharePoint. Except that the machine on which I was running this application also had SharePoint 2013 installed.

IIS 32 Bit SharePoint

Solution

In IIS 8, all the global (i.e. loaded into every AppPool) native ISAPI modules are loaded from the GlobalModules section. However this can be changed as IIS fully supports conditionally loading an ISAPI module depending on if its a 32 or 64 bit, managed or classic pipeline or even specific Web Application’s.

Run the following command using the Windows Command Prompt. This would basically direct the SPNativeRequestModule to only be loaded when the application pool is running in Integrated Mode and 64-bit application mode.


"%systemroot%\system32\inetsrv\AppCmd.exe" set config -section:system.webServer/globalModules /[name='SPNativeRequestModule'].preCondition:integratedMode,bitness64

Sorry, only tenant administrators can add or give access to this app

So, I just created my SharePoint Hosted App. Nothing fancy, just the default SharePoint Hosted App project template using Visual Studio and some minor plumbing to retrieve the user profile information using the JSOM.
After deploying the App, I was continuously getting error following error.

Access denied. You do not have permission to perform this action or access this resource.

I started debugging and found that this error occurs when I access the user profile store. Strange! Because, I had already specified the Read permissions for User Profiles in App using the AppMenifest.xml

UserProfileDemo_Permissions

And it turns out to be that after deploying the App, you need to say that you trust this App to access the resources (in this case, user profile store). I went ahead and guess what, another shocker in the form of the message below and for some reason I am not allowed to trust the App I just built.

Sorry, only tenant administrators can add or give access to this app

UserProfileDemo

But hey, this is my development environment. I have the Farm Administrator rights as well as the Local Administrator rights on the machine.

Resolution

After looking around on Google if there are other people having the same issue, I found this blog post from Chris Weldon. He suggested to add user explicitly to the Farm Administrator group. But it turned out that this was not enough to solve the issue I was facing.
Finally, what worked me was something similar. I added my user account explicitly to the Local Administrator group on my machine, reset the IIS and yes it works. 

What is Action Learning? An introduction!

I hear and I forget, I see and I remember, I do and I understand
(Confucius)

What we have to learn to do, we learn by doing
(Aristotle)

The concept of action learning was structurally applied in education by Reg Revans as early as in 1940s. The contemporary action learning guru, Revans has never provided a single and comprehensive statement of action learning and at different times emphasized one aspect or omitted another (Mumford, 1995). He preferred to describe action learning as what it is not.

(Pedler, 1991) came up with the definition for Action learning as an approach to the development of people in organizations which takes the task as the vehicle for learning. It is based on the premise that there is no learning without action and no sober and deliberate action without learning. The method has three main components—people, who accept the responsibility for taking action on a particular issue; problems, or the tasks that people set themselves; and a set of six or so colleagues who support and challenge each other to make progress on problems.

(Lex Dilworth, 1995) has called action learning “the DNA of a learning organization” since action learning both enables and forces organizations to continuously learn on an organization-wide basis and thereby be better able to adapt to the continuously changing environment.

(Marquardt, 1999) described, action learning as both a dynamic process and a powerful program. It involves a small group of people solving real problems, while at the same time focusing on what they are learning and how their learning can benefit each group member, the group itself, and the organization as a whole.

All the major contributors of action learning emphasised that it is the ‘action’ which is the core of this learning methodology. It is clear enough from various definitions that the action learning methodology is not only a methodology but also a process which helps the individuals, teams and organizations to make themselves self-dependent in solving the problems. It also creates an environment where they progressively grow while learning from their activities at the same time.