Wednesday, March 7, 2012

Removing old Work Item Type from TFS 2010 Team Project

To remove an old work item type (WIT) from TFS 2010 Team Project
  1. Open Visual Studio Command Prompt under Microsoft Visual Studio 2010 -> Visual Studio Tools
  2. Make sure that you have admin permissions, and run
witadmin destroywitd /collection:<url of the collection> /p:<team project name> /n:<work item type>


*joychua97

Wednesday, February 22, 2012

Adding text to an Off-page reference in Visio

I am creating a Visio diagram and I need to use the Off-page reference. Unlike other shapes that I can double click to assign a text, when I double click on an Off-page reference, it redirects me to its referenced shape in another page.

So how can I add text to my Off-page reference? Here are two ways:
1) Left-click on the Off-page reference, and press the F2 key, or
2) Left-click on the Off-page reference, and click the Text command on the toolbar (Home ribbon).  Shortcut key is CTRL+2.

Also make sure that you check the "Keep shape text synchronized" option when initially creating an Off-page reference. This will ensure that changes to the text of any of the shape references will be automatically reflected to the other (avoiding possible confusion if  you happen to have a number of references).






















*joychua97

Friday, February 17, 2012

Running InstallUtil unattended

The following command runs InstallUtil.exe unattended and passing username and password:

InstallUtil.exe /unattended /username=<domain\username> /password=<password> Service.exe

IMPORTANT NOTE: The switches (username, password, etc) must be placed before the name of the service to be installed, otherwise the switches will not be used. I made this mistake so I initially thought that these switches were not working :)

Use the /? or /help switch to learn more about the other options that can be used in installing the service

InstallUtil.exe /? Service.exe

*joychua97

Redirecting output of PowerShell scripts

Now I have finished creating the first part of my PowerShell script, and I now want to create some sort of logging instead of just having the output printed on the console. So I need to redirect the output to a log file, and still see on the console what is being written to the file.

To achieve this, I used  Tee-Object as shown below. This will redirect even the error messages to the log file and continuously display the contents of the file as it is written to.


     ./samplescript "input parameters" 2>&1 | Tee-Object  "logfile.txt"


To redirect just the output to the log file and leave error messages to the console:


     ./samplescript "input parameters" > "logfile.txt"

Here are the other Windows PowerShell redirection operators:

Operator Description Example
> Redirects output to the specified file, overwritting its current contents. ./samplescript "input parameters" > "logfile.txt"
>> Appends output to the current contents of hte file. ./samplescript "input parameters" >> "logfile.txt"
2> Sends errors to the specified file. Overwritting its current contents. ./samplescript "input parameters" 2> "errorfile.txt"
2>> Appends errors to contents of the specified file. ./samplescript "input parameters" 2>> "errorfile.txt"
2>&1 Sends error messages to the success output stream ./samplescript "input parameters" 2>&1 "logfile.txt"


Reference: http://technet.microsoft.com/en-us/library/dd315283.aspx

*joychua97

Wednesday, February 15, 2012

TF.exe commands

Looking for tf.exe commands to include in my PowerShell script, and the reference in http://msdn.microsoft.com/en-US/library/1yft8zkw(v=vs.80).aspx is quite helpful.

I'll update this post with the exact commands later on :)

*joychua97

Redirecting PowerShell script output to a file

I just wanted to redirect my PowerShell script output to a file, and at the same time see what's being written to the file.

This command does the trick:
 D:\Scripts\Sample.ps1 2>&1 |Tee-Object -File D:\Logs\myScriptLog.log

Reference:
http://stackoverflow.com/questions/3822650/how-can-i-output-handbrake-output-to-both-the-screen-and-to-a-file

*joychua97

Restoring default icon for .dll files

I opened some .dll and .pdb files in Notepad, and now their icons was changed, and the recommended program is now Notepad. Not something that I want :)

To fix this, I did these steps. I think the combination of these steps worked

1) Opened regedit and browsed to HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\filetype\OpenWithList
     > Removed all values under the OpenWithList key. Retained only the (Default) value
     > Removed the UserChoice key

2) Lastly, opened up command prompt as an Administrator, and ran "assoc .dll=dllfile"

References: http://technet.microsoft.com/en-us/magazine/ee851670.aspx http://answers.microsoft.com/en-us/windows/forum/windows_vista-files/restore-default-file-icon-of-file-types-dll-and/6917a74b-2f99-44ed-86a3-7bd52d240b7e


*joychua97