Enable/Disable ipv6 in command line

By default IPv6 is not enabled on windows XP Pro and Windows Server 2003. However, its very easy to enable IPv6 with netsh (net shell) command line tool.

Enable ipv6

netsh interface ipv6 install

Disable ipv6

netsh interface ipv6 uninstall

To verify if ipv6 is enabled, run ipconfig /all and see if ipv6 address is returned.

Note: you can use netsh to enable/disable ipv4, just change ipv6 to ipv4 in above commands.

Run IIS in 32-bit mode on a 64 bit machine

IIS 7 / 7.5 / 8

On IIS 7 / 7.5 / 8,  configure website or web application to run under 32 bit mode can be configured by opening a command prompt and typing following command and press ENTER.

%windir%system32inetsrvappcmd set config -section:applicationPools -applicationPoolDefaults.enable32BitAppOnWin64:true

You can achieve the same goal in IIS Manager by opening the ‘Advanced Settings’ on the application pool binded to the website/web application you want to run under 32 bit mode and change “Enable 32-bit Applications” to True

Enable 32 bit applications in IIS 7

Click okay and now the web application or website you configured will run under 64-bit mode always.


For IIS6 on Windows Server 2003, configure ASP.NET to run in 32 bit mode on a 64 bit windows server.open a command prompt and type following command and press ENTER.

cscript //nologo %SYSTEMDRIVE%InetPubAdminScriptsadsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 1

In IIS 6, you cannot run one Application Pool in 32-bit and others in 64-bit. But you can do this on IIS 7 and later as Enable32BitAppOnWin64 can be configured per application pool since IIS 7.  

Install PowerShell From Command Line

To install PowerShell on Windows Server 2008 R2 or Hyper-V Server 2008 R2, following features needs to be installed.

  1. NetFx2-ServerCore
  2. NetFx3-ServerCore
  3. MicrosoftWindowsPowerShell

Because Powershell is built on DotNet framework, DotNet 2.0 and 3.5  has to be installed prior to PowerShell installation.

To install PowerShell from command line, run following from elevated command prompt

DISM.exe /online /enable-feature /featurename:NetFx2-ServerCore DISM.exe /online /enable-feature /featurename:NetFx3-ServerCore DISM.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShell

Or run following command if it’s an 64bit machine

DISM.exe /online /enable-feature /featurename:NetFx2-ServerCore-WOW64 
DISM.exe /online /enable-feature /featurename:NetFx3-ServerCore-WOW64 
DISM.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShell-WOW64 

Access denied when creating a folder just deleted

I have a batch script which remove a folder and re-create it. The command that remove a folder is rd /s/q and the command create folder is mkdir. Recently I see something weird happening, everytime when the folder is deleted and re-created, there is error message Access is denied displayed. However, if I rerun the create folder command laer, it always pass successfully.

The explanation on http://support.microsoft.com/?id=159199 seems make sense,

This file is in a state known as pending deletion. This file has been deleted, but there are still handles open to it. NTFS will wait until all handles to this file are closed before updating the index. If an attempt is made to access the file, however, NTFS will deny the attempt. Because the file is listed in the index, but is effectively deleted, you can see the file but you cannot access it.

The workaround here is add a 60 seconds sleep between the folder deletion and folder creation operation.

Disable standby/sleep

powercfg.exe is a windows built in tool to config power management. powercfg.exe is a command line utility, it’s easy to integrate powercfg.exe into scripts.

Turn hibernation off

powercfg -hibernate OFF

Set the power configuration to High Performance

powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

Set the absentia power scheme (the scheme used when no one is logged in)

powercfg.exe -setabsentia 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c