The MED-V Blog

The Microsoft Enterprise Desktop Virtualization blog.

Complete Listing of MED-V Variables in Version 1.0 SP1

Complete Listing of MED-V Variables in Version 1.0 SP1

  • Comments 2
  • Likes

CMDThe following is a list of the entire default environment variables used by MED-V 1.0 Service Pack 1 organized by use context.

Variables Allowed for Renaming Computer during VM Setup

During the VM Setup process, there is an optional action to rename the computer. When configuring this process in the VM Setup tab, you will see an option for "VM Computer Name Pattern" near the bottom of the page.

Variable

Description

%Workspace

The name of the MED-V workspace being used by this image during the VM setup.

%User

The name of the user logged on to MED-V during the VM setup.

%Domain

The domain name (short name) of the authenticating MED-V Active Directory domain.

%Hostname

The hostname of the physical machine running the MED-V Client using this workspace.

%VMName

The name of the Virtual Machine name (Name of the virtual machine image file used by the workspace.)

Variables that can be used by Command Actions during the VM Setup Script

During the VM first time setup, there is an option to use a command line. The command line has its own set of variables that can be used with the command being used.

Variable

Description

%MEDVUser%

MED-V authenticated user name. The user name and password can be used in the join domain VM setup script.

%MEDVPassword%

MED-V authenticated password. The user name and password can be used in the join domain VM setup script.

%MEDVDomain%

The domain configured in the MED-V authentication. It can be used on the VM setup script.

%DesiredMachineName%

The unique computer name configured in the management application. It can be used in the VM setup script.

For example, a common task needed by many MED-V v1 administrators is a way to automate adding a regular MED-V user into the local administrator’s group. This is an example where use of this command line option with associated variables comes in very handy. In this particular case, we use the following command/argument combination:

Command: "c:\windows\system32\net.exe"

Arguments: "localgroup /add administrators %MEDVDomain%\%MEDVUser%"

Variable in the Guest

There is also a %MEDVHOSTNAME% variable that is set in the operating system of the guest virtual machine. It is a system variable that defaults to the host name of the host computer.

Steve Thomas | Senior Support Escalation Engineer

The App-V Team blog: http://blogs.technet.com/appv/
The WSUS Support Team blog: http://blogs.technet.com/sus/
The SCMDM Support Team blog: http://blogs.technet.com/mdm/
The ConfigMgr Support Team blog: http://blogs.technet.com/configurationmgr/
The OpsMgr Support Team blog: http://blogs.technet.com/operationsmgr/
The SCVMM Team blog: http://blogs.technet.com/scvmm/
The MED-V Team blog: http://blogs.technet.com/medv/
The DPM Team blog: http://blogs.technet.com/dpm/
The OOB Support Team blog: http://blogs.technet.com/oob/
The Opalis Team blog: http://blogs.technet.com/opalis

clip_image001 clip_image002

Comments
  • Can you add a command-line step to set the DesiredComputerName prior to the domain join step to add custom logic to decide the computer name?

  • Figured this out on my own.  You cannot set DesiredComputerName variable to change the desired computer name, this variable is not exposed in the environment, it can be passed as read only input on the command options of the VM Setup script.

    I also found that %MEDVHOSTNAME% does not existing during the "VM Setup" phase.

    My customer wanted to set the MED-V computer name based on specific attributes of the host pc name (SiteCode-AssetTag).  To make this happen I set the computer pattern in the policy to M%Hostname, and in the VM setup script called the following command-line:

    Path: c:\windows\system32\cscript.exe

    Command-Line: c:\windows\system32\Rename.vbs %desiredcomputername%

    My VBscript then extracted the site code and asset tag from the host pc name passed as the first argument to my script.  It then renamed the computer using WMI, and I used the MED-V action to restart.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment