Archive for the 'Windows OS' Category

SQL Server 2012 Service Pack install fail

Problem description

Installing SQL Server 2012 Service Pack 3 update, and ran into the following problem:

The install package extracts setup files, flashes a command window, and disappears.  Nothing appears to be installed.  I tried running the package in elevated administrator mode and with the /action=Patch switch – no luck. SQL Server setup log Summary.txt contained no entries at all.

Windows Application event log showed some warnings such as the screenshot below:


(.NET Runtime version 2.0.50727.5485 – Error ‘Invalid syntax on line 166’)


This problem was fixed by running the following command:


-machine   -reset

If you’re using 64-bit framework, run the following command:


-machine -reset


No system reboot was required in my case.

PowerShell script to monitor server disk space and send out email alerts

When you’re managing a large SharePoint installation, storage issues are going to be a major concern.   Whether it’s ULS logs, IIS logs,  SQL databases and transaction logs – whatever it is, when left to its own devices, SharePoint can consume a lot of space very quickly, and before you know it, your disks will be running out of space.

I found a cool PowerShell script by Colin Smith called Disk Space Monitor (see it here:  For whatever reasons, I had problems getting the email component to work properly, and I also wanted to tweak the email message format.   One thing led to another, and I ended up re-writing a few other sections of Colin’s script to better suit my needs.  The final product appears below  – it reads a list of servers, checks the free space on each server, and sends out an email summary to a list of users you specify. 

How to use this script:

Step 1.  Create a simple text file with a list of your servers to audit, single column, single-spaced, like this:





Let’s call the list “list.txt”.  Save the file.

Step 2. Create a batch file (let’s call it “start.bat”) and enter the following code in it.  Make sure to enter your own path for the server list as well as the output log file.

REM  Usage:  powershell %~dp0DiskSpaceMonitor.ps1  <computer list file path>   <output log path>
powershell  %~dp0DiskSpaceMonitor.ps1 C:\Scripts\DiskSpaceMonitor\list.txt   C:\Scripts\DiskSpaceMonitor\output.txt


Step 3. Create a PowerShell script file in the same directory as “start.bat”,  let’s call it “DiskSpaceMonitor.ps1”, and enter the following code in it.  Make sure to specify your own list of users to email and your SMTP server name or IP address.  Save the file, and execute “start.bat”.

# This script performs the following actions:

#  1) Read a list of servers
#  2) For each server on the list, get disk drive information - drive letter, drive size, free space, percent free
#  3) Email the report to users specified by the $users variable
$users = "user1 @", "user2 @ " , "user3 @"

$server = "SMTP server name or IP address"

$port = 25

$list = $args[0]

$output = $args[1]

$computers = get-content $list

echo "SharePoint Storage Report" > $output
echo " " >> $output
echo "Note: Free space below 30% is labeled with *** " >> $output
echo " " >> $output
echo " " >> $output
echo "ServerName    Drive Letter Drive Size Free Space Percent Free" >> $output
echo "----------    ------------ ---------- ---------- ------------" >> $output
foreach ($line in $computers)
 $computer = $line 
 $drives = Get-WmiObject -ComputerName $computer Win32_LogicalDisk | Where-Object {$_.DriveType -eq 3}
 foreach($drive in $drives)

 $id = $drive.DeviceID
 $size = [math]::round($drive.Size / 1073741824, 2)
 $free = [math]::round($drive.FreeSpace  / 1073741824, 2)
 $pct = [math]::round($free / $size, 2) * 100
 if ($pct -lt 30) { $pct = $pct.ToString() + "% *** " }

 else {  $pct = $pct.ToString() + " %" }

echo "$computer   $id  $size  $free  $pct"  >> $output

$pct = 0 


foreach ($user in $users)

$to      = $user

$from    = "<a href=""></a>"

$subject = "Connect Storage Report"

foreach ($line in Get-Content $output)


$body += “$line `n”


# Create mail message

$message = New-Object $from, $to, $subject, $body

#Create SMTP client

$client = New-Object system.Net.Mail.SmtpClient $server, $port

# Credentials are necessary if the server requires the client # to authenticate before it will send e-mail on the client's behalf.

$client.Credentials = [system.Net.CredentialCache]::DefaultNetworkCredentials

# Try to send the message

try {      


"Message sent successfully"

# reset variables

$body = ""


# Catch an error

catch {

"Exception caught in CreateTestMessage1(): "



# End of Script


Find out who’s connected to Windows Server

Sometimes when you try to connect to a server using Remote Desktop (RDP), you might receive this error:


(“The terminal server has exceeded the maximum number of allowed connections.”)

This message means that there are at least 2 other active RDP sessions on the server (unless it’s a Terminal Services server, and that’s another story.).  Since you can’t log on, you can’t easily find out who else might be logged on.  One or both of these sessions may be inactive (someone logged in and forgot to log off), and if you’re working on a large team, it may be a hassle to find out who is connected.  Luckily, there’s a built-in tool in Windows Server which will tell you who is connected to your server:  qwinsta.

Here’s how to use it:

1. Log on to another server using an account that has administrative access to the server which is generating the error message.

2. Open command prompt and type in the following:

qwinsta /server:%SERVERNAME%  

where %SERVERNAME% is the name of your server.

More details about the syntax:    qwinsta /?

MS TechNet article:


Another method is to use query session command instead of qwinsta.  The syntax is exactly the same. 

You can also use Terminal Services Manager to connect to another server and see RDP sessions.

Installing Microsoft Office Project Server 2007 on Windows Server 2008 SP2

If you try to install Project Server 2007 on Windows Server 2008 with Service Pack 2, the Setup program will give you an error message such as this one:

“The program is blocked due to compatibility issues.”

The solution for this error is the same as the solution for a similar error with SharePoint Server 2007 – you need to slipstream the latest service pack files into your Project Server installation (the SharePoint solution was described by Martin Kearn here.)

To successfully load Project Server 2007 on Windows Server 2008 SP2, follow these steps:

1. Copy Project Server 2007 installation files from the CD to a local directory on your hard drive, such as C:\Project2007.

2. Download Project Server 2007 SP2 files from this location:

Choose the appropriate download for your architecture (32-bit or 64-bit).

3. From the command prompt, extract the update files to a local folder using /extract switch. Example: c:\ProjectServer2007sp2-kb953334-x86-fullfile-en-us.exe /extract:c:\Project2007SP2\

4. Copy the extracted SP2 files to /Updates directory in the Project Server 2007 installation folder on your hard drive.

5. You can now install Project Server 2007 on Windows Server 2008 SP2.

Force autologon after logging off

This isn’t strictly SharePoint-related, but might be useful to a sysadmin somewhere…

I have a few servers that are running old-fashioned console apps (meaning that there always has to be a specific user session logged in for these apps to run properly). The server is configured with an autologon feature so when the system is restarted (after patching or a power outtage), the apps are also automatically restarted.
Sometimes these apps will stop responding, and we need to restart them using a script; however, we don’t want to restart the entire server.
The problem I ran into was, if you just log off the user session, it doesn’t automatically log back in – it gets stuck on the username/password screen.

It turns out, there is a registry setting that controls this behavior. Here it is:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\ForceAutoLogon

This is a string value; if you set it to 1 (and configure the remaining registry values for auto-logon), then when you log off, Windows will log you right back in.

Automatic Updates service fails to start

After I installed Service Pack 2 on my Windows XP workstation, the Automatic Updates service failed to start with the following error:

The Automatic Updates service terminated with the following error:
The class is configured to run as a security id different from the caller.

After some searching online, I found out that this problem is created when certain Administrative security templates are applied to a computer before installing XP SP2. I finally came across the solution here:

The solution turned out to be a one-line command entered at the command prompt:

Here’s the output:
AutomaticUpdates Fix

After I entered it, the AU service started beautifully…

Now I have to figure how to resolve a pesky TFS error message and fix the search index in my SharePoint farm…

RSS Information Week Headlines

  • An error has occurred; the feed is probably down. Try again later.

RSS SharePoint Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS InfoPath Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Joel Oleson Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Bud Ratliff blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Susan Hanley’s KM Blog

  • An error has occurred; the feed is probably down. Try again later.

Blog Stats

  • 382,118 hits