Change Windows hostname from command-line interface

You can use the following command to change computer’s hostname through the command-line interface:

netdom renamecomputer %COMPUTERNAME% /Newname “NEW-NAME”

Rebuild Team Foundation Server client’s computer cache

You can force a rebuild of the cache on each client computer the next time the client computer connects to a team project collection by using the witadmin rebuildcache command.

To prevent workspace errors from occurring during version control or build operations in Team Foundation, the data cache on client computers must be updated after certain maintenance operations. After you move, restore, rename, or fail over a data-tier or application-tier server, you must refresh the cache for tracking work items and users must refresh the version control cache on client computers.

The following is the syntax of the witadmin rebuildcache command:

witadmin rebuildcache /collection:CollectionURL [/noprompt]

Example:
The following command invalidates the metadata cache for all clients that connect to Tfs_DefaultCollection that is defined on the server that is named TfsServer. The client caches are updated the next time they connect to the project collection.

witadmin rebuildcache /collection:http://TfsServer:8080/tfs/Tfs_DefaultCollection

Configure Team Foundation Server Proxy <Servers> nodes

The <Servers> node contains one or more nodes that correspond to one or more instances of Visual Studio Team Foundation Server or team project collections from which the proxy server caches files.

Each <Server> node contains a <Uri> node that specifies either a computer that is running Team Foundation Server or a single team project collection on Team Foundation Server.

1) If you specify a computer that is running Team Foundation Server, the proxy can cache files from all collections on that server.

2) If you specify a single team project collection, the proxy can cache files only from that collection.

Example 1:
The <Servers> node might resemble the following example if the proxy were caching version control files from every collection on a server that is named TfsServer, using the default values for port and virtual directory:


<Servers>
 <Server>
  <Uri>
  http://tfsserver:8080/Tfs
  </Uri>
 </Server>
</Servers>

Example 2:
The <Servers> node might resemble the following example if the proxy were caching version control files from Tfs_DefaultCollection on a server that is named TfsServer, using the default values for port and virtual directory:


<Servers>
 <Server>
  <Uri>
  http://tfsserver:8080/Tfs/Tfs_DefaultCollection
  </Uri>
 </Server>
</Servers>

How to clear the Team Foundation Server 2010/2012/2013 cache on client machines?

You just need to save the following content to a .bat file and execute on the saved .bat file on the client machine.

REM **********************************************************
REM Script for clearing Team Explorer 2010/2012/2013 cache
REM **********************************************************

REM **********************************************************
REM Change directory to the Team Foundation Server 2010 client cache
REM **********************************************************
cd “%localappdata%\Microsoft\Team Foundation\3.0\Cache\”
for /d %%a in (*_http) do rmdir /s /q %%a

REM **********************************************************
REM Change directory to the Team Foundation Server 2012 client cache (ignore if it does not exist)
REM **********************************************************
cd “%localappdata%\Microsoft\Team Foundation\4.0\Cache\”
for /d %%a in (*_http) do rmdir /s /q %%a

REM **********************************************************
REM Change directory to the Team Foundation Server 2013 client cache (ignore if it does not exist)
REM **********************************************************
cd “%localappdata%\Microsoft\Team Foundation\5.0\Cache\”
for /d %%a in (*_http) do rmdir /s /q %%a

ECHO “All Done!”

How to clear the Team Foundation Server 2013 cache on client machines?

You just need to save the following content to a .bat file and execute on the saved .bat file on the client machine.

@echo off
REM **********************************************************
REM Script for clearing Team Explorer 2013 cache
REM **********************************************************

REM **********************************************************
REM Change directory to the Team Foundation Server 2013 client cache
REM **********************************************************
cd “%localappdata%\Microsoft\Team Foundation\5.0\Cache\”
for /d %%a in (*_http) do rmdir /s /q %%a

ECHO “All Done!”

How to clear the Team Foundation Server 2012 cache on client machines?

You just need to save the following content to a .bat file and execute on the saved .bat file on the client machine.

@echo off
REM **********************************************************
REM Script for clearing Team Explorer 2012 cache
REM **********************************************************

REM **********************************************************
REM Change directory to the Team Foundation Server 2012 client cache
REM **********************************************************
cd “%localappdata%\Microsoft\Team Foundation\4.0\Cache\”
for /d %%a in (*_http) do rmdir /s /q %%a

ECHO “All Done!”

How to clear the Team Foundation Server 2010 cache on client machines?

You just need to save the following content to a .bat file and execute on the saved .bat file on the client machine.

@echo off
REM **********************************************************
REM Script for clearing Team Explorer 2010 cache
REM **********************************************************

REM **********************************************************
REM Change directory to the Team Foundation Server 2010 client cache
REM **********************************************************
cd “%localappdata%\Microsoft\Team Foundation\3.0\Cache\”
for /d %%a in (*_http) do rmdir /s /q %%a

ECHO “All Done!”

Error launching AVD

If you encounterthe following error when you attempt to launch the AVD, you can try the suggestion resolution.

>emulator: ERROR: x86 emulation currently requires hardware acceleration!
>Please ensure Intel HAXM is properly installed and usable.
>CPU acceleration status: HAX kernel module is not installed!

1) Make sure you have installed “Intel x86 Emulator Accelerator (HAXM installer)” on your SDK Manager.

2) After you have download “Intel x86 Emulator Accelerator (HAXM installer)” and make sure you run the setup located in: {SDK_FOLDER}\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm-android.exe.

Note: If you get the error “VT not supported” during the installation, disable Hyper-V on the Windows features. Similarly, you can also execute this command

dism.exe /Online /Disable-Feature:Microsoft-Hyper-V.

You will also need “Virtualization Technology” to be enabled on your BIOS.

Solving npm WARN engine cordova-js@3.8.0: wanted… warning

If you encounter the following warnings or similar when you attempt to install Apache Cordova, you can perform one of the suggested two options to resolve this warning.

C:\>npm install -g cordova
npm WARN engine cordova-js@3.8.0: wanted: {“node”:”~0.10.x”} (current: {“node”:”
0.12.0″,”npm”:”2.5.1″})
npm WARN engine npm@1.3.4: wanted: {“node”:”>=0.6″,”npm”:”1″} (current: {“node”:
“0.12.0”,”npm”:”2.5.1″})
npm WARN engine xmlbuilder@2.2.1: wanted: {“node”:”0.8.x || 0.10.x”} (current: {
“node”:”0.12.0″,”npm”:”2.5.1″})
C:\Users\Neelabh\AppData\Roaming\npm\cordova -> C:\Users\Neelabh\AppData\Roaming
\npm\node_modules\cordova\bin\cordova
cordova@4.3.0 C:\Users\Neelabh\AppData\Roaming\npm\node_modules\cordova
├── underscore@1.7.0
├── q@1.0.1
├── nopt@3.0.1 (abbrev@1.0.5)
└── cordova-lib@4.3.0 (valid-identifier@0.0.1, osenv@0.1.0, properties-parser@0.
2.3, bplist-parser@0.0.6, mime@1.2.11, unorm@1.3.3, semver@2.0.11, shelljs@0.3.0
, dep-graph@1.1.0, rc@0.5.2, elementtree@0.1.5, xcode@0.6.7, d8@0.4.4, glob@4.0.
6, npmconf@0.1.16, through2@0.6.3, init-package-json@1.3.0, request@2.47.0, tar@
1.0.2, plist@1.1.0, cordova-js@3.8.0, npm@1.3.4)

The above error is due to Node.js 0.12.X which was released recently.

Option 1:

Run the following

npm install -g cordova@4

to force npm installing the newer version. Cordova 4 works with both 0.10 and 0.12 Node.js version.

Option 2 (preferred option):

Downgrade your Node.js installation to 0.10.X.

Finding the Windows product key VBScript

If you planned to do a reinstall of Windows but you cannot find your Windows product key, you are in luck because the product key is stored in the Windows registry. Follow the following steps to restore the product key:

Step 1: Copy and paste the following into a Notepad window:

Set WshShell = CreateObject(“WScript.Shell”)
MsgBox ConvertToKey(WshShell.RegRead(“HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId”))

Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = “BCDFGHJKMPQRTVWXY2346789”
Do
Cur = 0
x = 14
Do
Cur = Cur * 256
Cur = Key(x + KeyOffset) + Cur
Key(x + KeyOffset) = (Cur \ 24) And 255
Cur = Cur Mod 24
x = x -1
Loop While x >= 0
i = i -1
KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
If (((29 – i) Mod 6) = 0) And (i <> -1) Then
i = i -1
KeyOutput = “-” & KeyOutput
End If
Loop While i >= 0
ConvertToKey = KeyOutput
End Function

Step 2: You will need to use File -> Save As, change the “Save as type” to “All Files” and then name the file as <FILENAME>.vbs where <FILENAME> denotes the name of the file to be saved.

Step 3: Once you have saved the file, you can just double-click on the saved file, and the popup window will show you your product key.