Monthly Archives: May 2014

Install HyperV or another feature using installshield

I am using installshield 2013, but this may apply to other versions.

My goal was to be able install the hyperV feature on a windows 2012 server using installshield.

First you follow the directions at

Add the property IS_PS_EXECUTIONPOLICY and set it to Unrestricted


Add a Predefined System Search to check for powershell

InstallShield Add System Search

Installshield system search powershell

Create a new custom action. I am using a powershell from a binary table

InstallShield Add custom action

I am being lazy so the script I am running is on my desktop
Add Install Exec Sequence: After InstallFinalize
Add Install Exec Condition: POWERSHELLVERSION

InstallShield PowerShell custom Action

Now comes the magic,
Installshield runs using 32 bit mode by default, which means it also runs the 32bit powershell verison, From what I can tell the 32bit version of PowerShell doesn’t implement a bunch of stuff, so you either have to convert your installshield project to strict 64bit or put some magic at the top of you Powershell script to switch it to 64bit

To set your installshield project to strict 64bit (see

set the template x64; 1033
Installshield 64bit template

then you must tell the release to be strict about using 64bit components only

InstallShield Release Strict

The other option is to use the magic from I choose to use the magic at the top of my power shell since I may have to install 32 bit components as part of my installer, so I didn’t want to be restricted to only installing 64bit components.

# am I running in 32 bit shell?
if ($pshome -like "*syswow64*") {
    write-warning "Restarting script under 64 bit powershell"

    # relaunch this script under 64 bit shell
    # if you want powershell 2.0, add -version 2 *before* -file parameter
    & (join-path ($pshome -replace "syswow64", "sysnative") powershell.exe) -file `
        (join-path $psscriptroot $myinvocation.mycommand) @args

    # exit 32 bit script

# start of script for 64 bit powershell

 whoami | Add-Content -Path c:\file.txt
 echo "check admin" | Add-Content -Path c:\file.txt
 $64bit = [Environment]::Is64BitProcess

 ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
        [Security.Principal.WindowsBuiltInRole] "Administrator") | Add-Content -Path c:\file.txt

Add-Content -Path c:\file.txt -Value (’64-bit process = ‘ + $64bit);
echo "check feature" | Add-Content -Path c:\file.txt
Get-WindowsFeature | Where-Object {$_.Name -eq "Hyper-V"}  | Add-Content -Path c:\file.txt
$check = Get-WindowsFeature | Where-Object {$_.Name -eq "Hyper-V"}
If ($check.Installed -ne "True") {
        echo "notInstalled" | Add-Content -Path c:\file.txt
        #Install/Enable SNMP Services
        #Add-WindowsFeature SNMP-Services | Out-Null
        echo $check.Installed | Add-Content -Path c:\file.txt
        echo "Do Install" | Add-Content -Path c:\file.txt
        Install-WindowsFeature –Name Hyper-V -IncludeManagementTools -whatif | Out-File -Append c:\file.txt
else {
  echo "Installed" | Add-Content -Path c:\file.txt

Please excuse the c:\file.txt, those were my way of debugging to see what was going on.

I still need to work on handling the required reboot, but that is tomorrows problem

Start Microsoft Remote Desktop Session from command line on mac

You need to have at least 8.0.6 installed.

Start a command prompt

open "rdp://full address=s: mode id=i:1&Desktopheight=i:1024&Desktopwidth=i:1280"

I am still trying to workout how to pass a username with a domain, when I put in &username=s:localhost\administrator it appears in the login box as


For a full list of commands that should work see

Centos/RHEL stops looking for a dhcp ip

I managed to mess up my vm network a few times and the centos machines lost there DHCP address, what surprised me was that they stopped requesting an IP address, so once I fixed my KVM test machine I would have to connect to the console restart the network

I found a website that mentions a setting


That you can set in the /etc/sysconfig/network-scripts/ifcfg-eth0

Edit the file

sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0

Append line PERSISTENT_DHCLIENT=1, at the end configuration should look as follows:


Save and close the file. Restart networking service or reboot laptop / desktop to test the changes:

# /etc/init.d/networking restart