(I'm using Express 2012 web and desktop)
The Express editions install all the correct registry keys for detecting the latest installed version, but they don't have the InstallDir property. They do have this other key/value, though...
PS> Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VS7
11.0 : C:\Program Files (x86)\Microsoft Visual Studio 11.0\
Which identifies a more root directory than the regular install, so you'd have to build up the $VsRootDir differently...
$VsKey = Get-ItemProperty -Path "$script:rootVsKey\SxS\VS7" -ErrorAction SilentlyContinue
$VsRootDir = Join-Path $VsKey.$version 'Common7'
I don't know if you'd always try to search both paths or implement a switch to choose strategies.
(I'm using Express 2012 web and desktop)
The Express editions install all the correct registry keys for detecting the latest installed version, but they don't have the
InstallDirproperty. They do have this other key/value, though...PS> Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VS7 11.0 : C:\Program Files (x86)\Microsoft Visual Studio 11.0\Which identifies a more root directory than the regular install, so you'd have to build up the
$VsRootDirdifferently...I don't know if you'd always try to search both paths or implement a switch to choose strategies.