Enable Disk Cleanup on Server 2008 R2 Without Using Add Features

Scenario

You’re running out of space on a computer running Server 2008 R2, but cannot find the Disk Cleanup tool. You know you can add it using Add Features > Desktop Experience, but you just want Disk Cleanup; not the other stuff.

Solution

You need to copy a few files from C:\Windows\winsxs.
Here is a batch script to copy the files to the correct locations, and also pin Disk Cleanup to the Start Menu (using VBScript called PinItem.vbs, shown below): [Read more…]

NLB Unicast vs Multicast

I just read this great post that explains the differences between Unicast and Multicast when using Network Load Balancing (NLB):

http://deinoscloud.wordpress.com/2010/02/10/microsoft-network-load-balancing-nlb-on-vmware-esx/

SQL Server full and transaction log backups completing but differential backups failing because of Veeam B&R configuration

Scenario

I recently refreshed our SQL Server Maintenance Plans, but System Centre Essentials has been intermittently reporting failures of the daily differential backups, with an error like this:

Executing the query “BACKUP DATABASE [DBNAME] TO DISK = N’…” failed with the following error: “Cannot perform a differential backup for database “DBNAME”, because a current database backup does not exist. Perform a full database backup by reissuing BACKUP DATABASE, omitting the WITH DIFFERENTIAL option. BACKUP DATABASE is terminating abnormally.”. Possible failure reasons: Problems with the query, “ResultSet” property not set correctly, parameters not set correctly, or connection not established correctly.

The strange thing is that the logs show all Weekly Full backups have completed without error. If I run a manual Full Backup, the next Differential Backup will complete, then the following day will fail.

Solution

First, I used the following query to show more details on the backups (make sure you select the DB in SSMS first):

[Read more…]

Ultimate Active Directory resource page

I recently suffered an Active Directory meltdown than made me look to the sky and curse the Gods of Redmond!

I had many good resources to refer to, but I’m sure this page full of linky goodness would’ve helped further: http://blogs.technet.com/b/askds/archive/2010/07/27/post-graduate-ad-studies.aspx

Well worth reading if you want a thorough understanding of the underlying components in Active directory.

Virtualizing SQL Server on Windows Server 2012 – New Features and Performance Tuning

I recently read this excellent post on the TechNet Blogs: http://blogs.technet.com/b/keithmayer/archive/2012/08/30/virtualizing-microsoft-sql-server-on-windows-server-2012-winserv-mssql-itpro-sqlpass.aspx

The post highlights many new features in the latest version of Hyper-V, then goes over sizing virtualized SQL Server workloads and performance tuning.

Find out what’s going on with your SQL Servers

Have your SQL Servers ever gone mental on you all of a sudden, and you wish you could quickly see an overview of what was running at the time?

I just found these useful queries on a Spiceworks forum.

The first one will show you what is currently being executed on your server:

SELECT s.session_id AS SessionID,
 s.login_time AS LoginTime,
 s.[host_name] AS HostName,
 s.[program_name] AS ProgramName,
 s.login_name AS LoginName,
 s.[status] AS SessionStatus,
 st. AS SQLText,
 (s.cpu_time / 1000) AS CPUTimeInSec,
 (s.memory_usage * 8) AS MemoryUsageKB,
 (CAST(s.total_scheduled_time AS FLOAT) / 1000) AS TotalScheduledTimeInSec,
 (CAST(s.total_elapsed_time AS FLOAT) / 1000) AS ElapsedTimeInSec,
 s.reads AS ReadsThisSession,
 s.writes AS WritesThisSession,
 s.logical_reads AS LogicalReads,
 CASE s.transaction_isolation_level
 WHEN 0 THEN 'Unspecified'
 WHEN 1 THEN 'ReadUncommitted'
 WHEN 2 THEN 'ReadCommitted'
 WHEN 3 THEN 'Repeatable'
 WHEN 4 THEN 'Serializable'
 WHEN 5 THEN 'Snapshot'
 END AS TransactionIsolationLevel,
 s.row_count AS RowsReturnedSoFar,
 c.net_transport AS ConnectionProtocol,
 c.num_reads AS PacketReadsThisConnection,
 c.num_writes AS PacketWritesThisConnection,
 c.client_net_address AS RemoteHostIP,
 c.local_net_address AS LocalConnectionIP
 FROM sys.dm_exec_sessions s INNER JOIN sys.dm_exec_connections c
 ON s.session_id = c.session_id
 CROSS APPLY sys.dm_exec_sql_text(c.most_recent_sql_handle) AS st
 WHERE s.is_user_process = 1
 ORDER BY ElapsedTimeInSec DESC

This next one can show blocking processes… you can use the blocking session ID to track down the other processes:

SELECT dm_ws.wait_duration_ms,
 dm_ws.wait_type,
 dm_es.status,
 dm_t.TEXT,
 dm_ws.session_ID,
 dm_es.cpu_time,
 dm_es.memory_usage,
 dm_es.logical_reads,
 dm_es.total_elapsed_time,
 dm_es.program_name,
 DB_NAME(dm_r.database_id) DatabaseName,
 dm_ws.blocking_session_id,
 dm_r.wait_resource,
 dm_es.login_name,
 dm_r.command,
 dm_r.last_wait_type
 FROM sys.dm_os_waiting_tasks dm_ws
 INNER JOIN sys.dm_exec_requests dm_r ON dm_ws.session_id = dm_r.session_id
 INNER JOIN sys.dm_exec_sessions dm_es ON dm_es.session_id = dm_r.session_id
 CROSS APPLY sys.dm_exec_sql_text (dm_r.sql_handle) dm_t
 WHERE dm_es.is_user_process = 1

Reference

Changing a UCC/SAN Certificate and Re-Issuing from GoDaddy

Scenario

When initially setting up the Unified Communications Certificate (UCC) certificate for Exchange, autodiscover.domain.com was not added as a Subject Alternative Name (SAN).

You need to enable autodiscover in Exchange 2010 for external devices (iOS, laptop Outlook etc.) without a security warning.

Solution

The certificate needs to be updated with autodiscover.domain.com as a SAN.

These instructions pertain to a GoDaddy certificate – other providers will likely be different.

An A record had already been created in the domain’s DNS zone pointing autodiscover.domain.com to the public IP address of the router.

As it turns out, GoDaddy offer the opportunity to drop and replace SANs from their UCC certificates at will – with domain ownership validation required if any are added, of course.

Here are the steps:

[Read more…]

Adding a node to a SQL Server 2008 R2 Failover Cluster using Server 2008 R2

Scenario

You’ve successfully installed and configured a SAN, a Failover Cluster and an instance of SQL Server 2008 R2 on one node. Now you need add another node to this cluster so the SQL Server instance can failover.

Solution

  1. From the setup menu, select Installation > Add node to a SQL Server failover cluster:

  2. Click OK after the first set of checks:
    [Read more…]

Installing SQL Server 2008 R2 on a Failover Cluster using Server 2008 R2

Scenario

You’ve configured a Failover Cluster using Server 2008 R2, and now you want to install SQL Server 2008 R2.

Solution

Changes

A few changes were made to the simple Failover Cluster that was previously configured:

  • Several LUNs were added to the FreeNAS VM so separate disks could be used for each function:
  • 3 x Network Interface Cards (NICs) were configured on each node, each on a different subnet:
    • LAN: 10.10.10.0/24
    • SAN: 10.10.20.0/24
    • Heartbeat: 10.10.30.0/24
  • The FreeNAS interface was configured on the SAN subnet (10.10.20.220).

This time round, the Failover Cluster Validation Report didn’t have a single warning; all green ticks 😉

[Read more…]

Check IIS Application Pool Identity using C#

To check the IIS Application Pool Identity using C#, use the System.Security.Principal class:

using System.Security.Principal;

then add the following code to the Page_Load method:

WindowsIdentity id = WindowsIdentity.GetCurrent();
Response.Write("IIS Application Pool Identity
"); Response.Write("Name: " + id.Name + " ");