Complete Listing of MED-V Variables in Version 1.0 SP1

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.




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


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


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


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


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.




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


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


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


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:
The WSUS Support Team blog:
The SCMDM Support Team blog:
The ConfigMgr Support Team blog:
The OpsMgr Support Team blog:
The SCVMM Team blog:
The MED-V Team blog:
The DPM Team blog:
The OOB Support Team blog:
The Opalis Team blog:

clip_image001 clip_image002

Comments (2)
  1. Levi Stevens says:

    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?

  2. Levi Stevens says:

    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:windowssystem32cscript.exe

    Command-Line: c:windowssystem32Rename.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.

Comments are closed.

Skip to main content