Category Archives: Useful tips

Enable remote connections in SQL Server 2008

Basically few things:

  • SSMS -> server properties -> Connections
    Allow remote connections to this server checked
  • SSMS -> server properties -> Security
    SQL Server and Windows Authentication mode checked
  • SQL Server Configuration Manager -> SQL Server Network Configuration TCP/IP enabled
  • TCP/IP -> Properties -> IP Addresses
    Every IP needs to have 1433 (default one) port set
  • sometimes Firewall needs extra inbound rule for 1433 port
    (Click on Advanced Settings on the left hand side and you should see the Windows Firewall with Advanced Security. Select the Inboud Rules on the left hand side and click on New Ruleā€¦ on the right hand side.)

Woulktrhough here

Executing PowerShell scripts via Task Scheduler

I used excellent script Delete files older than x-days – Cleanup Script which requires bunch of parameters.

Sample command:

.\deleteold.ps1 -FolderPath "D:\test" -FileAge 7 -LogFile "D:\log.txt" -autolog -VerboseLog -CleanFolders

Most important parameters:

  • FolderPath
    The path that will be recursively scanned for old files.
  • Fileage
    Filter for age of file, entered in days. Use -1 for all files to be removed.
  • AutoLog
    Automatically generates file name at path specified in -logfile. If a file name is specified in the LogFile parameter and the AutoLog parameter is used only the path specified in LogFile is used. The file name is created with the following naming convention:

  • VerboseLog
    Logs all delete operations to log, default behavior of the script is to log failed only.
  • CleanFolders
    If this switch is specified any empty folder will be removed. Default behavior of this script is to only delete folders that contained old files.

Creating a task in Task Scheduler

Just give it a name

Use schedule when you want to run it


  • Program/script:


    Check what PowerShell version you have and update the path

  • Arguments:
    -Command "& d:\scripts\deleteold.ps1 -FolderPath "D:\test" -FileAge 0 -LogFile "D:\log.txt" -autolog -VerboseLog -CleanFolders; exit $LASTEXITCODE"

    exit $LASTEXITCODE is used to get exit code from the script
    O learnt this from Dmitry’s


Start or Stop MS SQL Server using a shortcut

  • Create a new shortcut.
  • When it asks you to browse or specify the location of what you want the shortcut to point to, enter the following

    cmd /c net start MSSQLSERVER 


    cmd /c net stop MSSQLSERVER 
  • Click next, and call the shortcut whatever you want.

Important: MSSQLSERVER is your SQL instance name
Thanks to Just geeks

If you are running Windows 7, you might want to set running shortcuts as Administrator.

  • right click on the shortcut
  • in ‘Shortcut’ click ‘Advanced’ button
  • check ‘Run as administrator’ option


ASP.NET The length of the query string for this request exceeds the configured maxQueryStringLength value.

Similar problem happens described by error:

The request filtering module is configured to deny a request where the query string is too long.

Solution, step 1 in web.config:

		<httpRuntime maxQueryStringLength="4096" />

<!-- OR -->

		<httpRuntime maxQueryStringLength="4096" />

Solution, step 2 IIS:
In the Connections pane, go to the connection, site, application, or directory for which you want to modify your request filtering settings.
In the Home pane, double-click Request Filtering.


Click Edit Feature Settings… in the Actions pane.


Specify your options, and then click OK.


Source: Request Limits

IIS 7.5 first request very slow

This is somewhat hard to tell whats going on on your other server, however here’s a simple checklist you might want to reconsider:

  1. Always pre-compiling your site, as opposed to copying it! you might gain a significant performance boost compiling your website before deployment: ASP.NET Precompilation Overview
  2. Do not run the production application with debug=”true” enabled, when debug flag is true in your web.config, Much more memory is used within the application at runtime, and since some additional debug paths are enabled, codes can execute much slower
  3. Check your Web.config file to ensure trace is disabled in the section
  4. IIS 7.5 comes with the Auto-Start Feature. WAS (Windows Process Activation Service) starts all the application pools that are configured to start automatically, ensure that your application pool is configured to AlwaysRunning in the IIS 7.5 applicationHost.config, check out here for more detail
  5. Check out the ASPNET.CONFIG file to see if the configuration on both servers are still the same. Every server can be well configured by aspnet.config file located in the root of the framework folder
  6. Ensure that Publisher Evidence for Code Access Security (CAS) is set to false in your aspnet.config file, This might increase the initial page load when you restart the ASP.NET app pool. you can read more about it here.Here’s how to disable checking for CAS publisher policy for an application:
            <generatePublisherEvidence enabled="false"/>
  7. also you might want to try Application Initialization Module for IIS 7.5, this module also available on IIS 8.0 can decrease the response time for first requests by pre-loading worker processes

Source: Stack Overflow

Visual Studio – The project type is not supported by this installation

Check ‘ProjectTypeGuids’ in .csproj file, to see which project type (GUID) may not be supported.
In my case I had MVC3 installed with Visual Studio Express. Later I got Visual Studio Ultimate and MVC3 was not supported by default. Installing MVC3 once again solved the problem.

Helpful sources:
Stack Overflow – GUIDS
SharePoint Space – edit GUID values
Dev Help – Project Type GUIDs

How to use one connection to the Internet for VPN and another for accessing other websites?

You also asked about split tunneling, so let’s take a moment to explain that concept before walking through the process of creating a VPN connection. By default, when you create a VPN connection, Windows funnels all of the communications from your computer through the VPN. So, if you’re logged into a corporate VPN from home to check your email, all of the other Web surfing you’re doing on your computer is also being run through your corporate network. This is the default behavior because, from the company’s point of view, it’s the safest way and ensures all traffic is protected regardless of the destination.

You might not want this behavior, however, for a couple of reasons. First, it allows your company to inspect all of your personal Web traffic while connected to the VPN. Second, it will likely slow down your access to the Web, as everything must first be sent through the VPN.

Split tunneling, on the other hand, configures the VPN connection so that only traffic headed to computers on the corporate network is sent through the VPN connection. Other traffic leaving your computer goes out through your normal network connection.

Follow these steps to set up a VPN connection in Windows Vista that uses split tunneling:

  1. From the Control Panel, choose “Network & Internet.”
  2. Click “View Network Status and Tasks.”
  3. Click “Manage Network Connections.”
  4. Right-click on your VPN connection and select “Properties.”
  5. Select the “Networking” tab.
  6. Highlight “Internet Protocol Version 4 (TCP/IP v4).”
  7. Click “Properties.”
  8. Click “Advanced.”
  9. Uncheck the “Use default gateway on remote network” box.
  10. Click “OK” three times to close the windows you opened.

From that point forward, only traffic destined for your corporate network will be sent through the VPN. All other traffic will use the local network.

source: SuperUser