Writing

  • “Cannot add duplicate collection entry of type…” error in IIS 7/7.5

    ,

    I came across an “HTTP Error 500.19 – Internal Server Error” error when trying to access a static page on IIS 7 running on Windows 2008 Server.  So, here’s what I did that fixed the issue: 1. Checked the event logs first and saw this: 2. Checked out the ISAPI Filters of the “Default Web…

  • PowerShell Pack

    In case you didn’t know, PowerShell has a pack that offers add-on goodies.  Get it at: http://archive.msdn.microsoft.com/PowerShellPack/Release/ProjectReleases.aspx?ReleaseId=3341

  • Visual Studio 2010 access denied on “Publish”

    I was getting the errors below when publishing to a file system: Connecting to C:\inetpub\wwwroot\webapp… Transformed Web.config using Web.Debug.config into obj\Debug\TransformWebConfig\transformed\Web.config. Copying all files to temporary location below for package/publish: obj\Debug\Package\PackageTmp. Publishing folder /… Unable to add ‘Web.config’ to the Web site.  Unable to add file ‘Web.config’.  Access is denied. Publishing folder Account… Publishing folder…

  • PowerShell: Extracting certain lines in any file

    ,

    I had quite a large file that I needed to parse, and the challenge was to extract certain lines that didn’t match a certain condition.  The solution . . . PowerShell, like so: select-string -path filename -notmatch "criteria" | foreach {$_.line} | out-file -filepath filename -encoding ascii That’s it!

  • PowerShell: Deleting entire lines in a text file based on a partial string match

    PS C:\workspace> (gc “fileToParse.txt”) -notmatch "<criteria>" | out-file "resultFile.txt" Note: <Criteria>, for example, “not".

  • PowerShell: Rename file to lowercase

    ,

    1. Open PowerShell 2. CD into directory to work on 3. Execute the following command: get-childitem * -recurse | rename-item -newname { $_.name.ToLower() }