PowerShell tweaks for controlling Virtual Server

On Tuesday I talked about how to control Virtual Server from PowerShell.  Since then I have come up with a couple of simple tweaks to make interacting with Virtual Server easier.

  1. Load the interop DLL as part of your profile.

    You can create your own personal profile script that gets run for all PowerShell instances by creating the file ‘profile.ps1’ in a ‘PSConfiguration’ directory under your ‘My Documents’ folder.  I have created this and added the command to load the Virtual Server interop DLL: [System.Reflection.Assembly]::loadfrom(“C:\Documents\PSConfiguration\VSWrapperForPSH.dll”) > $null (note that I am redirecting to $null so I do not see any of the output each time).

  2. Create a script for setting COM security.

    I have created a script called ‘SetSecurity.ps1’ with the following contents:


    Note that in order to run scripts you will need to ‘set-executionpolicy’ appropriately.

  3. If you are running Vista and need to run PowerShell as administrator – you can do this by manually creating a new shortcut and checking this option under the compatibility tab

With these three steps – interacting with Virtual Server is quite easy:

Virtual Server and PowerShell