PowerShell Setup

Signing PowerShell Scripts

1. Opening Windows PowerShell 1.0 gets this error
Windows PowerShell
Copyright (C) 2006 Microsoft Corporation. All rights reserved.
File \asdfWindowsPowerShellMicrosoft.PowerShell_profile.ps1 cannot be loaded because the execution
 of scripts is disabled on this system. Please see "get-help about_signing" for more details.
At line:1 char:2
+ . <<<< '\asdfWindowsPowerShellMicrosoft.PowerShell_profile.ps1'
PS L:>
PS L:> Get-ExecutionPolicy
Restricted
PS L:> Set-ExecutionPolicy remotesigned
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution
policy?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
PS L:>

 Process should have elevated status to access IIS configuration data.

Windows Server settings Background Services and using for SQL Server

Here are some related discussions.

 

1) Here’s a link for a discussion about the setting.

If the value was set to 0 then that means that the Foreground and background applications equally responsive. I tested it in my LAB. on my system default value was set to 2 and when changed to Background services registry value changed decimal 24. Sometime it may happen that the settings you configure via GUI doesn’t take effect properly thus registry can edited directly. If you have value 24 in registry then your system is optimized for Background Services. No need to worry then.

Look at this section below from- http://support.microsoft.com/kb/102987

========================================================

PriorityControl Entries

The PriorityControl key defines the foreground/background priority boost differential. Change this value by choosing the Tasking button in the System dialog box in Control Panel. Values are stored under this Registry path:

   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\PriorityControl
		

Win32PrioritySeparation REG_DWORD 0, 1, or 2

Default:   0x2
		

Specifies the priority to give to the application running in the forground. This application receives more process or time relative to other applications running in the background. The values here correlate to the following options in the Tasking dialog box:

Value Meaning

0          Foreground and background applications equally responsive
1          Foreground application more reponsive than background
2          Best foreground application response time
		

========================================================

Cheers!


Sachin Gadhave
MCP, MCSA, MCTS 

 

2) And here’s another one

 For SQL Server you can choose Background Services. But there a lot of more setting you need to configure:

  • To enable SQL Server to use large pages, enable the Lock pages in memory user right assignment for the account that will run the SQL Server: From the Group Policy MMC snap-in (Gpedit.msc), navigate to Computer Configuration > Windows Settings > Security Settings > Local Policies > User Rights Assignment. Double-click Lock pages in memory and add the accounts that have credentials to run SQL Server.
  • You can set a fixed amount of memory for the SQL Server process to use. About 3% of the total available memory is used for the system, and another 1% is used for memory management structures. SQL Server can use the rest of available memory, but not more. The following equation is available to calculate total memory to be used by SQL Server: TotalMemory – (1%memory * (numa_nodes)) – 3%memory – 1GB memory
  • Set CPU affinity for the SQL process: Set affinity mask to partition the SQL process on specific cores. To set affinity on more than 32 logical processors, use affinity64 mask. Starting with SQL Server 2008 R2, you can apply equivalent settings for configuring CPU affinity on as many as 256 logical processors using the ALTER SERVER CONFIGURATION SET PROCESS AFFINITY Data Definition Language (DDL) TSQL statement as the sp_configure affinity mask options are announced for deprecation. Use the ‘alter server configuration set process affinity cpu =’ command to set affinity to the desired range of processors for each k-group, separated by comma.

This are just a few settings, in this whitepaper you will find more settings you need to configure (choose the ones that you find relevant): Performance Tuning Guidelines for Windows Server 2008 R2

Install 64-bit ACE.OLEDB Download Microsoft Access Database Engine 2010 with 32-bit Office

 

  1. Download Microsoft Access Database Engine 2010 Redistributable here
  2. Install the version you need. I have 32-bit Office and a 64-bit PC using Windows 7 so had to do this to avoid the error about uninstalling Office:
  3. AccessDatabaseEngine_X64.exe /passive
  4. And it worked!

EDIT:

But it also now creates a problem whenever an OFFICE document is opened. Here’s a solution, although I had to add the “NoReReg REG_DWORD 1” myself in HKCU\Software\Microsoft\Office\14.0\Word\Options
Microsoft Office 2010 Professional Plus configures each time you start 

Msg 7415, Level 16, State 1, Line 1. Ad hoc access to OLE DB provider ‘ MSDASQL’ has been denied.

Unless you are an ‘sa’ you probably will get this error.

Fix it by adding this setting to the registry.

Value Data
DisallowAdHocAccess 0

 


— Quickly check your registry settings running this on SQL 2005+ servers

EXEC master..xp_regenumvalues 
                        ‘HKEY_LOCAL_MACHINE’,
                        ‘SOFTWARE\Microsoft\Microsoft SQL Server\<instance>\Providers\MSDASQL’

— or on SQL 2000

EXEC master..xp_regenumvalues 
                        ‘HKEY_LOCAL_MACHINE’,
                        ‘SOFTWARE\Microsoft\MSSQLServer\Providers\MSDASQL\’

How to remove Reporting Services from SQLServer 2008 R2

1.In Add/Remove programs
2.Click the ‘Uninstall/Change’ button for “SQL Server 2008 R2”
3.In the coming dialog, click ‘Remove’
4.Click ‘OK’
5.In the ‘Select Instance’ dialog,  select the appropriate instance of the SQL Server (!) and then click ‘Next’
6.In the ‘Select Features’ dialog, please only select ‘Reporting Services’
7.Then click ‘Next’ and ‘Next’ till the uninstalling process starting

Step 6

Select Features

Step 7
Removal Rules

Ready to Remove

PowerShell and why I will learn it.

Up until SQL Server 2008, I didn't need PowerShell to manage my dozen servers and know exactly what was going on. Now I do.

And the benefits and capabilities are plentiful! You can start to be convinced by reading this article, "Why This SQL Server DBA is Learning Powershell", brilliantly conceived.

Next, use this site as a resource and examples.

Here is a great set of examples by MAK.