I took Peter avise and for a while I've been using Chris's vsvars32, however it had some drawbacks,
1. It did not work from a 64bit PowerShell
2. For some reason Get-Batchfile did not work for me, I had to modify to call "echo" explicitly.
I also added a helper VsInstallDir and a alias for devenv.
Enjoy,
Oscar
function global:VsInstallDir($version="10.0")
{
$VSKey = $null
if (test-path HKLM:SOFTWARE\Wow6432Node\Microsoft\VisualStudio\$version)
{
$VSKey = get-itemproperty HKLM:SOFTWARE\Wow6432Node\Microsoft\VisualStudio\$version
}
else
{
if (test-path HKLM:SOFTWARE\Microsoft\VisualStudio\$version)
{
$VSKey = get-itemproperty HKLM:SOFTWARE\Microsoft\VisualStudio\$version
}
}
if ($VSKey -eq $null)
{
throw "Visual Studio not installed"
}
[System.IO.Path]::GetDirectoryName($VsKey.InstallDir)
}
function Get-Batchfile ($file) {
$cmd = "echo off & `"$file`" & set"
cmd /c $cmd | Foreach-Object {
$p, $v = $_.split('=')
Set-Item -path env:$p -value $v
}
}
function global:VsVars32($version="10.0")
{
$VsInstallPath = VsInstallDir($version)
$VsToolsDir = [System.IO.Path]::GetDirectoryName($VsInstallPath)
$VsToolsDir = [System.IO.Path]::Combine($VsToolsDir, "Tools")
$BatchFile = [System.IO.Path]::Combine($VsToolsDir, "vsvars32.bat")
Get-Batchfile $BatchFile
[System.Console]::Title = "Visual Studio shell"
}
set-alias devenv ((VsInstallDir)+"\devenv.exe") -scope global
James wanned me to explain the set of steps I use to enable Convert-Media under a PowerShell remoting.
First a disclaimer: running these steps will lower the security settings of your PC, use with caution.
Here there are:
In your encoding server (mine is called tv-server):
Enable-PSRemoting -force # Enables remoting
set-item WSMan:\localhost\Client\TrustedHosts * -force # I am not running a domain controller, so my server needs to trust everybody
set-item wsman:localhost\Shell\MaxMemoryPerShellMB 1024 -force # The default allowed memory is very low, we need to bump it so that Convert-Media have room to work.
Enable-WSManCredSSP -Role Server -force # I need the server to have access to my Windows Home Server, so it needs to autenticate using credential delegation
In your client:
function AllowDelegation($policyName)
{
$keyPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation\"+$policyName
if (test-path $keyPath)
{
rmdir $keyPath -force -rec
}
$key = mkdir $keyPath
$key.SetValue("1","WSMAN/*");
}
AllowDelegation "AllowDefaultCredentials"
AllowDelegation "AllowFreshCredentials"
Enable-WSManCredSSP -Role Client -DelegateComputer * -force
In order to remote into your server do:
Enter-PSsession <ServerName> –cred <UserName>
I have used “*” (star) in two places, that’s too broad, if you are already using a DNS suffix I would recommend to use it and change “*” to “*.mydomain.com”.
In that case you need to refer to your server as:
Enter-PSsession <ServerName>.mydomain.com –cred <UserName>
Once inside, load the Encoder module as usual and execute Convert-Media.
You could Batch background encoding jobs using the instructions from the PowerShell team.
Enjoy,
Visdual Studio 2010 Beta is now available here.
Please start pounding it on it and let us know what you think.
I have been reading Christopher Alexander's "Notes on the Synthesis of Form", if you are into "Test Driven Design", Software Design and AgileSoftware Development you will find this book written by a building architect 45 years ago fascinating.
The author explains why some unconsiuos cultures can come up with better home designs than the developed (or self-consiuos) cultures. It also explains why a desing can only be created using test or "proofs".
Form there you can extrapolate to software development and see with a complete new perpective how the agile process approach the process of "Design".
In my personal case, It allow me to see why principles like YAGNI and KISS are fundamental to the process of design.
Even if you are not into agile, I definitely recommend this book, its a short read.
There are tons of new cool features in Visual Studio Team Architect 10.
- New UML Designers
- Architecture Explorer
- Layer Designer
Please download a give us feedback at Dev10 CTP Feedback page
If you have questions about the UML designers use the forums, we will be watching.
As Peter I have became infected with Powershell, and to make it worse, there is console mode editor support. Sweet!!!
I have one week using it, I am not going back to cmd.exe ever!!
Here is a great replacement for vsvars32.bat made by Brad Wilson.
I'll be in TechEd at the Visual Studio Team Architect demo station.
See you there.
Hello, after working with DevDiv and p&p as vendor for the past 7 years (wow, I can't believe it's so long) I finally joined Microsoft as a full time employee. I joined the VS Team Architect team as an SDE 2 months ago. I joined the team just in time for the Visual Studio 2008 release, I am really excited of the features that my team is delivering but more so about the ones in the future.
Joining Microsoft has been a huge change for me, both professionally and personally (I relocated from Costa Rica) and it's been an incredible busy year, so forgive me if I haven't answer your CAB and/or GAT questions (I know there are a couple here and there). Meanwhile I move the CAB and GAT articles from my previous employer web site to the msdn blog site.
Regards,
Oscar Calvo