共用方式為


Configuring Advanced Settings by Using Windows PowerShell

The MED-V workspace package that you create includes a Windows PowerShell script (.ps1) file that you can edit before you test and deploy your MED-V workspace package. This section provides information and guidance to help you manage MED-V configuration settings by using Windows PowerShell before you deploy the MED-V workspaces.

Using Windows PowerShell Cmdlets in MED-V

The following Windows PowerShell cmdlets are available in Microsoft Enterprise Desktop Virtualization (MED-V) 2.0:

New-MedvConfiguration

Export-MedvConfiguration

New-MedvWorkspace

Export-MedvWorkspace

To access Windows PowerShell cmdlets for MED-V, open Windows PowerShell and type the following command to import the MED-V modules.

Import-Module microsoft.medv

After the modules are imported, you can access inline help for the cmdlets by using the standard Windows PowerShell Help commands, man or get-help. For example, to access a description of the New-MedvConfiguration cmdlet including a complete list of available parameters, type the following command.

get-help New-MedvConfiguration

You can also view help for specific parameters. For example, to view help for the parameter VmMemory, type the following:

get-help New-MedvConfiguration -parameter VmMemory

To view a list of all MED-V configuration settings and their defaults, type the following command.

New-MedvConfiguration -ForceDefaults

To view a list of all MED-V configuration settings and their current values, type the following command.

gwmi -Class "Setting” -Namespace "root/microsoft/medv”

Creating a MED-V Workspace with Custom Settings

After you successfully create a MED-V workspace package by using the MED-V Workspace Packager, a Windows PowerShell script is generated in the folder you specified for saving your packager files. The contents of this script show some of the available MED-V configuration settings that you can edit.

Following these steps, you can customize the script and then run it in Windows PowerShell to create a MED-V workspace with the new settings.

Important   Run Windows PowerShell with administrative credentials, and ensure that the Windows PowerShell execution policy allows the running of scripts.

  1. Edit the Windows PowerShell script that was generated by the MED-V Workspace Packager, or author a new script with the configuration settings that you want.

  2. Run Windows PowerShell with administrative credentials and at the command prompt, type the following command.

    & “.\<workspacename>.ps1”
    

    This command runs the Windows PowerShell script and runs the New-MedvWorkspace cmdlet to generate a new MED-V workspace package. The new packager files are saved in the folder that you originally specified for storing your MED-V Workspace Packager files. For additional help about this cmdlet, see the Windows PowerShell Help.

Exporting a MED-V Configuration to a Registry File

You can update MED-V configuration settings after the MED-V workspace is installed. Use the New-MedvConfiguration cmdlet to specify the parameters that you want to change. For example, to create a registry file that changes the virtual machine memory setting, type the following commands.

New-MedvConfiguration  -VmMemory 1024 | Export-MedvConfiguration -Path c:\medvConfiguration\myConfig.reg

You can import the resultant registry file from the host computer to a MED-V workspace to apply the new configuration settings.

Managing MED-V Workspace Configuration Settings

Test And Deploy the MED-V Workspace Package