Category: Development

  • oh-my-zsh slow on WSL2 git directory

    You might notice oh-my-zsh very slow on WSL2 shell, especially when you cd into a directory with git enabled.

    This can be resolved by running following command

    git config --global oh-my-zsh.hide-status 1
  • git clone error “Operation not permitted” on WSL2 Shell

    On a clean installed WSL2 (Windows SubSystem for Linux Gen 2), you might get error “Operation not permitted” when trying to run command git clone on the shell.

    To resolve this, simple run following commands:

    sudo umount /mnt/c
    sudo mount -t drvfs C: /mnt/c -o metadata
    

    You might need to replace the drive letter if you hit error on other drivers.

  • Run Disk Cleanup tool on Windows Server without Installing

    If you are getting a low disk space alert on a Windows Server, the safest way to free some space is to run the Disk Cleanup wizard. However on Windows Server, by default Disk Cleanup is not installed. Installing it through “Add Windows Features” would trigger a reboot. To avoid this you can simply install it by copying two files cleanmgr.exe and cleanmgr.exe.mui with following commands:

    copy C:Windowswinsxsamd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7dacleanmgr.exe %systemroot%System32
    copy C:Windowswinsxsamd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63cleanmgr.exe.mui %systemroot%System32en-US

    Note: the above commands are for Windows Server 2008 R2. Check this website for other windows versions:

    http://technet.microsoft.com/en-us/library/ff630161(WS.10).aspx

  • Delete a project in Visual Studio Online Portal

    Microsoft announces Visual Studio Online general available this week. Visual Studio Online (aka VS Online) was named TFS Online for preview for quite a long time. Previously if you create test projects for practice, you might find it’s hard to discover how to delete projects. You can do that in either TFS Online Portal or Visual Studio client,  the only support tool is tfsdeleteproject.exe, which can only be found on a machine with Virtual Studio installed.

    Now in Visual Studio online, you can delete project in the portal control panel directly, though still a little hard to discover. Here are steps

    1. Login to your Visual Studio online home page and click the control panel icon on the right top.

      image

    2. In Administration Task secion, click View the collection administration page link image
    3. You will see all your project listed in this page. Select the project you want to delete and click the arror icon, you will see a link for project deletion. image
    4. You will see warning All data will be permanently deleted. image
  • Error The update is not applicable to your computer When Installing PowerShell V3

    PowerShell V3 and PowerShell ISE V3 is not a port of Windows 7 and Windows Server 2008 R2. However, you can download it from here.

    You might receive following error when you install the msu file

    The update is not applicable to your computer

    Solution

    1. Installed Windows 7 and Windows Server 2008 R2 Service Pack 1
    2. Install .NET 4.0 Full Profile. ( not client profile )
  • Registering ASP.NET 4.5 with IIS8

    In Windows Server 2012, DotNet 4.5 are shipped as part of OS but DotNet 4.5 is not registered with IIS8 be default. If you try to run aspnet_regiis.exe as you did for Windows Server 2008 R2, you will see following error

    Microsoft (R) ASP.NET RegIIS version 4.0.30319.17929
    Administration utility to install and uninstall ASP.NET on the local machine.
    Copyright (C) Microsoft Corporation. All rights reserved.
    Start installing ASP.NET (4.0.30319.17929).
    This option is not supported on this version of the operating system. Administrators should instead install/uninstall ASP.NET 4.5 with IIS8 using the “Turn Windows Features On/Off” dialog, the Server Manager management tool, or the dism.exe command line tool. For more details please see http://go.microsoft.com/fwlink/?LinkID=216771.
    Finished installing ASP.NET (4.0.30319.17929).

    Solution

    (Following step by step tutorials are copied from IIS 8.0 Using ASP.NET 3.5 and ASP.NET 4.5 )

    Step by Step Instructions enabling AspNet on IIS8

    (more…)

  • Install PowerShell and Powershell ISE on Windows Server

    Windows Server 2003

    For Windows server 2003, PowerShell V1 was released as KB ( hotfix). Download and install KB926139 – Windows PowerShell 1.0 English-Language Installation Package for Windows Server 2003

    If you need PowerShell V2, make sure you have SP2 installed and then install Windows Management Framework from http://support.microsoft.com/kb/968929

    Windows Server 2008

    For Windows Server 2008 run the following command in an elevated Command Prompt.

    servermanagercmd -install PowerShell

    Windows Server 2008 R2

    Windows Server 2008 R2 has PowerShell V2 built in and enabled by default, however, PowerShell ISE is not. It is installed on Windows 7 client OS, but an Optional Component on Windows Server 2008 R2. To Install PowerShell ISE on R2, run the following command in a Windows PowerShell Modules prompt

    Import-Module ServerManager
    Add-WindowsFeature PowerShell-ISE

    OR

    1. In Server Manager, start the Add Roles and Features wizard.
    2. On the Features page, select Windows PowerShell ISE.

    Windows Server 2012

    Windows Server 2012 has both PowerShell V3 built in and installed. PowerShell ISE needs to be added as it’s an optional Windows PowerShell feature, same as Windows Server 2008 R2.

    Also checkout How to run PowerShell scripts to start your first PowerShell script.

  • TFS How to change the computer name or owner for a workspace

    The owner and computer name of the workspace are not editable in Visual Studio 2010. However, you might need it when you renamed your machine or your account is renamed. To do this, open a Visual Studio Command Prompt (2010) from program files, and cd to your workspace, then run following

    Change the computer name for a workspace

    tf workspaces /updateComputerName:<OldComputerName> /collection:<CollectionURL>

    You need replace <OldComputerName> to your actual old computer name and <CollectionURL> to your actual TFS collection URL.

    Change the owner for a workspace

    tf workspaces /updateUserName:<OldUserName> /collection:<CollectionURL>

  • Using SCVMM 2012 Cmdlets in PowerShell

    SCVMM Cmdlets allow SCVMM admin/users to do everything they can do in SCVMM AdminConsole in windows PowerShell command line. In SCVMM 2008 R2, you can run following command in PowerShell to run SCVMM cmdlets.

    Add-PSSnapin Microsoft.SystemCenter.VirtualMachineManager

    But this does not work in SCVMM 2012 as SCVMM 2012 uses PowerShell module. For SCVMM 2012 now you need run following in PowerShell instead

    Import-Module "C:Program FilesMicrosoft System Center 2012Virtual Machine ManagerbinpsModulesvirtualmachinemanagervirtualmachinemanager"

    (This assumes that you have SCVMM 2012 installed on the default location C:Program FilesMicrosoft System Center 2012 )

    The PowerShell cmdlets in SCVMM 2012 change a lot in SCVMM 2012, you can get a list of all SCVMM 2012 cmdlets by typing the following at the PowerShell command shell prompt

    Get-Command -Module virtualmachinemanager -Type cmdlet

    And you can run Get-Help on any of the cmdlets to get the syntax for that cmdlet.

    Get-Help <cmdlet name> -detailed

    Update: Microsoft has published the SCVMM 2012 cmdlets help to TechNet, check it out http://technet.microsoft.com/en-us/library/hh801697.aspx

  • Highlight the file you work with in Visual Studio Solution Explorer

    Visual Studio 2010 Tip – Highlight the file you work with in Solution Explorer

    1. Go to Tools->Options->Projects and Solutions->General
    2. Check the "Track Active Item In Solution Explorer" checkbox.​