title: Operating system error 5(access is denied) when creating Database at Client Machine in C:\ Drive
body: <p>I am installing SQL Server Express 2005 as a prerequisite of my c# windows form application, and under the Custom Action of my installer class, I'm trying to execute the script below, to create my database on the user machine.</p>
  
  <p>However when I choose to create the database on the C:\ drive(the windows root folder), I am getting this error/exception:</p>
  
  <pre><code>Operating system error 5(access is denied)
  </code></pre>
  
  <p>I do not get any error if I try to do so in any other drive.</p>
  
  <p>Please Help me. How can I get the relevant privileges for this SQL query?</p>
  
  <pre><code>USE [master]
  GO
  /****** Object:  Database [Society_security_database]    Script Date: 08/11/2012 14:26:23 ******/
  CREATE DATABASE [Society_security_database] ON  PRIMARY 
  ( NAME = N'Society_security_database', FILENAME = N'C:\Society_security_database.mdf' , SIZE = 2048KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
   LOG ON 
  ( NAME = N'Society_security_database_log', FILENAME = N'C:\Society_security_database.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
   COLLATE SQL_Latin1_General_CP1_CI_AS
  GO
  EXEC dbo.sp_dbcmptlevel @dbname=N'Society_security_database', @new_cmptlevel=90
  GO
  IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
  begin
  EXEC [Society_security_database].[dbo].[sp_fulltext_database] @action = 'enable'
  end
  GO
  ALTER DATABASE [Society_security_database] SET ANSI_NULL_DEFAULT OFF 
  GO
  ALTER DATABASE [Society_security_database] SET ANSI_NULLS OFF 
  GO
  ALTER DATABASE [Society_security_database] SET ANSI_PADDING OFF 
  GO
  ALTER DATABASE [Society_security_database] SET ANSI_WARNINGS OFF 
  GO
  ALTER DATABASE [Society_security_database] SET ARITHABORT OFF 
  GO
  ALTER DATABASE [Society_security_database] SET AUTO_CLOSE OFF 
  GO
  ALTER DATABASE [Society_security_database] SET AUTO_CREATE_STATISTICS ON 
  GO
  ALTER DATABASE [Society_security_database] SET AUTO_SHRINK OFF 
  GO
  ALTER DATABASE [Society_security_database] SET AUTO_UPDATE_STATISTICS ON 
  GO
  ALTER DATABASE [Society_security_database] SET CURSOR_CLOSE_ON_COMMIT OFF 
  GO
  ALTER DATABASE [Society_security_database] SET CURSOR_DEFAULT  GLOBAL 
  GO
  ALTER DATABASE [Society_security_database] SET CONCAT_NULL_YIELDS_NULL OFF 
  GO
  ALTER DATABASE [Society_security_database] SET NUMERIC_ROUNDABORT OFF 
  GO
  ALTER DATABASE [Society_security_database] SET QUOTED_IDENTIFIER OFF 
  GO
  ALTER DATABASE [Society_security_database] SET RECURSIVE_TRIGGERS OFF 
  GO
  ALTER DATABASE [Society_security_database] SET  ENABLE_BROKER 
  GO
  ALTER DATABASE [Society_security_database] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
  GO
  ALTER DATABASE [Society_security_database] SET DATE_CORRELATION_OPTIMIZATION OFF 
  GO
  ALTER DATABASE [Society_security_database] SET TRUSTWORTHY OFF 
  GO
  ALTER DATABASE [Society_security_database] SET ALLOW_SNAPSHOT_ISOLATION OFF 
  GO
  ALTER DATABASE [Society_security_database] SET PARAMETERIZATION SIMPLE 
  GO
  ALTER DATABASE [Society_security_database] SET  READ_WRITE 
  GO
  ALTER DATABASE [Society_security_database] SET RECOVERY SIMPLE 
  GO
  ALTER DATABASE [Society_security_database] SET  MULTI_USER 
  GO
  ALTER DATABASE [Society_security_database] SET PAGE_VERIFY CHECKSUM  
  GO
  ALTER DATABASE [Society_security_database] SET DB_CHAINING OFF 
  </code></pre>