Saturday, August 31, 2013

Powershell Quick Tips: Generate GUID

Open all users startup folder in Windows 8

Using Run dialog (WinKey+r), type:
shell:common startup
or from the command line (cmd.exe) do:
explorer.exe shell:common startup


Using Winmerge to do compare and merge operation in VS 2010

Details on how to configure Visual Studio to use WinMerge for merge and compare operation is documented in

Powershell Quick Tips: Get details of network interface

Ethernet 3 - is the name of the interface

This will need Powershell 3.0 or later

PS Quick Tips: Change Primary DNS Server of a network interface

10 - is the interface index. This can be found by running Get-NetAdpater, this will be the column named ifIndex.
("") - is the DNS server address(es) you want to assign to that interface, this is a comma separated list.

This only works on Powershell 3 (or maybe later).


VirtualBox paravirtualized network adapter driver

From VirtualBox manual, paravirtualized network adapter provides the best performance. To get this interface from working within VirtualBox, you need to download the drivers separately/manually. Note that Windows driver online update utility does not have it as well.

Since driver is open source it can be found in few locations. A good source is from Red Hat, download it from this location Download virtio-win*.iso, mount it and install driver for your OS.

VBA: Using FileSystemObject to create a file

Sample code to create a file in VBA using FileSystemObject which is part of Microsoft Scripting Runtime. See this link on how to reference MSR.
Option Explicit

Sub TestMe()
    Dim fs As FileSystemObject
    Dim ts As TextStream
    Set fs = New FileSystemObject
    Set ts = fs.CreateTextFile("C:\tmp\file.txt", True)
    ts.WriteLine "Header1, Header2"
    ts.WriteLine "1," & CStr(DateTime.Now)
    Set ts = Nothing
    Set fs = Nothing
End Sub

Friday, August 30, 2013

Referencing Microsoft Scripting Runtime for FileSystemObject class in VBA IDE

From Visual Basic for Applications IDE, do Tools | References... then look for Microsoft Scripting Runtime or browse for C:\Windows\System32\scrrun.dll.

Microsoft  Scripting Runtime provides the following classes:

  • Dictionary
  • Drive
  • Drives
  • Encoder
  • File
  • Files
  • FileSystemObject
  • Folder
  • Folders
  • TextStream

Excel 2013 enable developers toolbar

Do File | Options | Customize Ribbon | select Developer option.

Sunday, August 18, 2013

Powershell Quick Tips: Get hostname from IP address

PS C:\>[System.Net.Dns]::gethostentry("")

Powershell Quick Tips: Start an interactive session on a remote computer

For the Linux/Unix geeks, ssh is preferred way to establish an interactive session to a remote machine. In Windows ssh can also be used but you have to install extra software. To perform interactive task on remote machine (though not as cool as ssh) one can try Powershell. So, to connect to a remote machine MACHINE1, do:

PS C:\>Enter-PSSession -ComputerName MACHINE1

For this to work, you need to have proper credentials on MACHINE1 (I have only tried with users members of domain admins).

TF259641: To use the environment, you must install a compatible test agent in all machines of the environment. Click 'Install Agents' to complete this task.

On a small domain test system that is connected to a production domain, see below for the network architecture, creating a new test environment with workgroup computers may not deploy the VS Test Agent 2012 properly.

The reason automatic deploy is not working is that the Test Agent deployed on the workgroup machines will try to contact the Test Controller located on another domain (DOMAIN1) but will not resolve as the Test Agents DNS server entries are configured from a DCHP connected to production domain.

You will typically get the following error message.
TF259641: To use the environment, you must install a compatible test agent in all machines of the environment. Click 'Install Agents' to complete this task.

In the workgroup machines, modify the IP (v4) Properties to point DNS of DOMAIN1. 

- TFS 2012 Update 3
- SCVMM 2012 Sp1
- Lab Manager 2012 Update 3

scrot - command line screen capture utility for minimal Lubuntu install

I have a minimalist installation of Ubuntu 13.04 using Lubuntu minimal package. By default it does not come with screen capture utility. To get Print Screen function working in Lubuntu, install scrot, like:

$$: sudo apt-get install scrot
Pressing PrtSc in Lubuntu will cause it to create a file in the home directory normally named <date>_<screen resolution>_scrot.png.

In Ubuntu 13.10, you have to run scrot first before PrintScreen works.

Saturday, August 17, 2013

TF259137: The following account does not have sufficient permissions to complete the operation: domain\user. The following permissions are needed to perform this operation: Create.

When importing virtual machine in MTM Lab Center you may encounter error message below:

TF259137: The following account does not have sufficient permissions to complete the operation: domain\user. The following permissions are needed to perform this operation: Create.

From what I know there is no UI that would allow the TFS admin to grant the necessary privileges related to library management. To fix this, do:

  1. Open a console where tfslabconfig.exe. In VS 2013 with MTM installed, it is located in C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE.
  2. Run the following command:
  3. TfsLabConfig Permissions /collection:http://[TFSMachineName]:8080/TFS/DefaultCollection /user:domain\user /allow:create,Read,ManageLocation,Write,edit,delete,start,stop,ManagePermissions,ManageChildPermissions,Pause,ManageSnapshots
Of course you have to replace [TFSMachineName] with the name of your TFS Server and this has to be run by user with TFS admin rights. You also have to change DefaultCollection and domain\user.


Get Linux user id

Linux user ID can be used in say mounting a CIFS share, see link. To get user id, do:
$: id timus
This will print UID and GID of user timus.

Check version of VirtualBox guest additions installed

$: locate vboxguest
If this returns nothing either you don't have VirtualBox guest additions installed or you need to update the database used by locate. If you suspect that the database may need a refresh, you can do sudo updatedb.

Alternatively, you can check contents of /opt. If you have the additions installed, it should have an entry like VBoxGuestAdditions*.

Friday, August 16, 2013

Mounting a Windows share using smbfs with read-write access

To mount a Windows share using smbfs do the following:
#: mount -t cifs -o username=your_user_name,uid=1000 //machine_name/share_name /mnt/point
Or the old style:
#: mount -t smbfs -o username=your_user_name,uid=1000 //machine_name/share_name /mnt/point
Note here that uid=1000 is not a magic number but rather your linux userid. You can get this value from passwd file normally located in /etc/passwd. The user with uid=1000 should be able to manipulate files pointed to by //machine_name/share.
And when connecting to a share that is mananged by Active Directory, need to escape the backslash for it to work, e.g.:
#: mount -t smbfs -o username=domain-name\\username,uid=1000 //machine_name/share_name /mnt/point

Need to install smbfs for this to work, like (Debian/Ubuntu):
#: sudo apt-get install cifs-utils


Sunday, August 11, 2013

ERROR: No configuration file found when booting Ubuntu 13.04 using USB stick

I created a boot-able network install of Ubuntu 13.04 on USB stick using Pendrive's Universal USB Installer (Universal-USB-Installer- Booting this USB stick on my old Eee PC 900 shows "ERROR: No configuration file found". To fix this rename/copy isolinux.cfg to syslinux.cfg.

As an alternative to Universal USB Installer, you may try Unetbootin(


PS Quick Tips: Format datetime with milliseconds

(Get-Process)[0].StartTime.ToString("yyyy/MM/dd HH:mm:ss.fffff")

This displays when the process at index zero was started with milliseconds information

Saturday, August 10, 2013

PS Quick Tips: Display service start times

Get-WmiObject win32_service | Where-Object {$_.State -eq "Running"} | ForEach-Object {Write-Host ((Get-process -id $_.ProcessId).StartTime)","$_.PathName","$_.DisplayName}
Run this in elevated prompt to get correct information.

Get-WmiObject win32_service | Where-Object {$_.State -eq "Running"} | ForEach-Object {Write-Host ((Get-process -id $_.ProcessId).StartTime.ToString("yyyy/MM/dd HH:mm:ss.fffff"))","$_.PathName","$_.DisplayName}
This add milliseconds to the service information