Archive

Archive for the ‘Microsoft’ Category

Windows 2008, and Hibernation

July 6th, 2010 2 comments

Whilst driving back from our 4th of July celebrations in San Antonio, I got alerted to a server running low on disk space.  As it hadn’t hit critical, and there was still a fair bit of space left, I decided to wait until I got home.  When I looked at the server, I pulled up my trusted space analyzer, TreeSize.

Read more…
Categories: Microsoft, Sys Admin, Work Tags:

IIS and unknown file types

June 17th, 2010 No comments

Since IIS6, or there abouts, IIS will not host a file that it does not understand, or doesn’t have a MIME handler for. This is a security feature, but can cause some unknown issues…

Read more…

Categories: Microsoft, Work Tags: ,

Cleaning up remote directories with PowerShell

May 24th, 2010 1 comment

Part of our application at work sends email notifications to various uses when certain criteria are met. This is great, except testing is difficult as you really don’t want to send out mails to valid customers, so we disable relaying outbound, and the local mail server just chomps on it a bit, then decides to not deliver it and drops it to the local file system. This is great, except in a the matter of days, we have 100k message files. This becomes entirely unmanageable with Windows, so PowerShell is here to help…

Read more…

SQL 2008 and MERGE

May 14th, 2010 No comments

A feature I’ve long awaited in Microsoft SQL (TSQL) has been a function similar to MySQL’s REPLACE function. For those that haven’t used it, the REPLACE function allows you to do an insert of a new record, or replace an existing record if one matches the primary key. In SQL 2008, Microsoft introduced a function called MERGE. This is like REPLACE, but a whole bunch of extra goodies…

Read more…

Categories: Microsoft, Technology Tags: , ,

Reverting a checkout from another workspace

May 6th, 2010 No comments

Every now and again, we have issues where a developer will have their laptop rebuilt, and forget they have files checked out in Team Foundation Server (TFS). This isn’t very helpful as sometimes they cannot undo their check outs. Visual Studio doesn’t give you access to undo a checkout in another workspace if it’s not your workspace, however the TF.exe command does. Here’s how:

tf /undo /workspace:workspacename;username $/project/path/to/file

This will happily undo the change on that particular file. If you have a whole directory to revert the changes on, that’s easy too…

tf /undo /workspace:workspacename;username /recursive $/project/path/to/directory

You must remember when reverting somebody else’s change to use the project URL, not the physical path on your local machine, otherwise you’ll get an error like this:

No pending changes were found for <localpathname>\file.aspx

For more details on the tf.exe undo command, see the Microsoft documentation here. Full details on arguments for the tf.exe command can be found here too.

Categories: Microsoft, Technology, Work Tags:

PowerShell: Top x Processes using CPU

April 6th, 2010 No comments

This is a quick and handy one for server monitoring, and tracking down that process that is using all your CPU. It makes use of WMI counters.

Read more…

PowerShell: Timing Commands

April 6th, 2010 2 comments

Curious about how long your script took to execute? How about just that cmdlet? Powershell has a built in function for you.

  • Open Powershell command prompt
  • Use the command Measure-Command like so:
Measure-Command {c:\scripts\yourscript.ps1}

Enjoy the output broken down by days, hours, minutes, seconds, milliseconds, and ticks.

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 34
Milliseconds      : 287
Ticks             : 342873445
TotalDays         : 0.000396844265046296
TotalHours        : 0.00952426236111111
TotalMinutes      : 0.571455741666667
TotalSeconds      : 34.2873445
TotalMilliseconds : 34287.3445

The same works for cmdlets too…

PS C:\scripts> Measure-Command {Get-Process}

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 0
Milliseconds      : 6
Ticks             : 65919
TotalDays         : 7.62951388888889E-08
TotalHours        : 1.83108333333333E-06
TotalMinutes      : 0.000109865
TotalSeconds      : 0.0065919
TotalMilliseconds : 6.5919
Categories: General Ramblings, Microsoft, PowerShell Tags:

PowerShell: Cleaning up IIS Logs

April 1st, 2010 2 comments

This one is a quick and easy one. We have multiple IIS boxes, which each generate large usage logs on a daily basis. To save space, and for analytics off-server, we compress the log files. Having found Rar is one of the better compression algorithms, we simply shell out to rar, compress the logs, and cleanup older logs.

Read more…

PowerShell: Remote Registry, and fixing an Office 2007 install

March 29th, 2010 No comments

We’ve had a stubborn Windows 2003 server that we’ve been trying to get Office 2007 installed for a while. It has a couple of things wrong with it which have made the install substantially harder.

Read more…

An error occurred while validating. HRESULT=80004005

March 12th, 2010 No comments

For the last day or so, we’ve been working on rolling out the next release of our code to our QA environment. When it came time to build a new set of solutions I stumbled across a weird validation error.

An error occurred while validating.  HRESULT=80004005

This error popped up on the setup applications for several new programs. Doing some searching I stumbled across a couple of posts that hinted on removing the project output from the setup, and trying again. This stopped the errors on the setup application, but not the actual application itself.

Then I saw a hint in the errors list…

Application Configuration file "App.config" is invalid. '-' is an unexpected token.

Checking into the app.config file, I stumbled across the cause. It looks like somebody had pasted code that had been “fixed” up by Outlook, or word, and broken a comment. Fixing this, resolved both the app compilation, and the setup validation error.

Categories: Microsoft, Work Tags: