[ Pobierz całość w formacie PDF ]
. The product key.Substitute your 25-digit product key number for the X's. A password for the local Administrator account on the virtual machine. The full name.The name or role of the person in whose name the virtual machine, created by using this profile, is registered.This is the name that appears on the General tab of a computer's System Properties page under Registered to. The name of the workgroup to which the virtual machine belongs. The path to the SysPrep.inf text file, which is the unattended answer file that the System Preparation tool, SysPrep.exe, uses to automate deployment of Windows operating systems on multiple computers.Parameters that are not specified use the default settings.For more information about guest operating-system profiles, type Get-Help New-GuestOSProfile at the command prompt.For more information about SysPrep.inf and SysPrep.exe, see Microsoft Knowledge Base article 302577, "How to use the Sysprep tool to automate successful deployment of Windows XP" at http://go.microsoft.com/fwlink/?LinkId=104720.# Define guest OS profile parameters.$OSProfileName = "Win2K3R2Profile"$ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"$AdminPassword = "!!123abc"$FullName = "VMMUser"$Workgroup = "VMWorkgroup"$SysPrepScriptPath = "\\LibraryServer1.Contoso.com\MSSCVMMLibrary\Scripts\SysPrep.inf"Define template parametersA Virtual Machine Manager virtual machine template, which stores hardware configuration and guest operating-system information, can be used repeatedly to create new virtual machines.After creating a hardware profile and a guest operating-system profile, the script constructs a template using the parameters defined in the profiles and from a sysprepped virtual hard disk that contains the Windows Server 2003 R2 operating system.The example script assumes that you have a sysprepped virtual hard disk called ENU-W2003-Std-R2-Sysprep.vhd.The script uses the parameters that are define in the template to set: The name of the template. The path to the virtual hard disk that contains the sysprepped virtual hard disk.Parameters that are not specified use the default settings.For more information about virtual machine templates, type Get-Help New-Template at the command prompt.# Define template parameters.$TemplateName = "Win2K3R2Template"$SysPrepVHDPath = "\\LibraryServer1.Contoso.com\MSSCVMMLibrary\VHDs\ENU-W2003-Std-R2-Sysprep.vhd"Define virtual machine parametersAfter creating a template, the script uses it to create a virtual machine.The script uses the parameters that are defined in the template to set: A unique name for each virtual machine. The path to a second virtual hard disk that the script adds to each virtual machine.The example script assumes that you have a virtual hard disk called BaseDisk20GB.vhd.This virtual hard disk is other than the sysprepped virtual hard disk that is used to provide the operating system to the virtual machines. The number of virtual machines that are created by the script.# Define virtual machine parameters.$VMName = "VMN_"$VMAdditionalVhdDiskPath = "\\LibraryServer1.Contoso.com\MSSCVMMLibrary\VHDs\BaseDisk20GB.vhd"$NumVMs = 2Define a Function That Creates a Secure CredentialThe next set of commands in the script AutomateNewVMCreation.ps1 defines a function that the script uses to create a Windows PowerShell credential object (PSCredential object) by prompting the user for the user name and password that are required to join a computer to the domain.##################################################################### Define a function to create a PSCredential object.####################################################################function SecurePass {param([string]$User, [string]$Password)$SPassword = New-Object System.Security.SecureStringfor ($i=0; $i -lt $Password.Length; $i++) {$SPassword.AppendChar($Password[$i])}New-Object System.Management.Automation.PSCredential $User,$SPassword}Connect to the Virtual Machine Manager ServerThe next command in the script AutomateNewVMCreation.ps1 connects to the Virtual Machine Manager server so that subsequent commands can access objects in the Virtual Machine Manager database.The command uses a value stored earlier in $VMMServer (in this case, localhost) to retrieve the server object from the Virtual Machine Manager library and store the server object in variable $C [ Pobierz całość w formacie PDF ]
zanotowane.pl doc.pisz.pl pdf.pisz.pl trzylatki.xlx.pl
. The product key.Substitute your 25-digit product key number for the X's. A password for the local Administrator account on the virtual machine. The full name.The name or role of the person in whose name the virtual machine, created by using this profile, is registered.This is the name that appears on the General tab of a computer's System Properties page under Registered to. The name of the workgroup to which the virtual machine belongs. The path to the SysPrep.inf text file, which is the unattended answer file that the System Preparation tool, SysPrep.exe, uses to automate deployment of Windows operating systems on multiple computers.Parameters that are not specified use the default settings.For more information about guest operating-system profiles, type Get-Help New-GuestOSProfile at the command prompt.For more information about SysPrep.inf and SysPrep.exe, see Microsoft Knowledge Base article 302577, "How to use the Sysprep tool to automate successful deployment of Windows XP" at http://go.microsoft.com/fwlink/?LinkId=104720.# Define guest OS profile parameters.$OSProfileName = "Win2K3R2Profile"$ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"$AdminPassword = "!!123abc"$FullName = "VMMUser"$Workgroup = "VMWorkgroup"$SysPrepScriptPath = "\\LibraryServer1.Contoso.com\MSSCVMMLibrary\Scripts\SysPrep.inf"Define template parametersA Virtual Machine Manager virtual machine template, which stores hardware configuration and guest operating-system information, can be used repeatedly to create new virtual machines.After creating a hardware profile and a guest operating-system profile, the script constructs a template using the parameters defined in the profiles and from a sysprepped virtual hard disk that contains the Windows Server 2003 R2 operating system.The example script assumes that you have a sysprepped virtual hard disk called ENU-W2003-Std-R2-Sysprep.vhd.The script uses the parameters that are define in the template to set: The name of the template. The path to the virtual hard disk that contains the sysprepped virtual hard disk.Parameters that are not specified use the default settings.For more information about virtual machine templates, type Get-Help New-Template at the command prompt.# Define template parameters.$TemplateName = "Win2K3R2Template"$SysPrepVHDPath = "\\LibraryServer1.Contoso.com\MSSCVMMLibrary\VHDs\ENU-W2003-Std-R2-Sysprep.vhd"Define virtual machine parametersAfter creating a template, the script uses it to create a virtual machine.The script uses the parameters that are defined in the template to set: A unique name for each virtual machine. The path to a second virtual hard disk that the script adds to each virtual machine.The example script assumes that you have a virtual hard disk called BaseDisk20GB.vhd.This virtual hard disk is other than the sysprepped virtual hard disk that is used to provide the operating system to the virtual machines. The number of virtual machines that are created by the script.# Define virtual machine parameters.$VMName = "VMN_"$VMAdditionalVhdDiskPath = "\\LibraryServer1.Contoso.com\MSSCVMMLibrary\VHDs\BaseDisk20GB.vhd"$NumVMs = 2Define a Function That Creates a Secure CredentialThe next set of commands in the script AutomateNewVMCreation.ps1 defines a function that the script uses to create a Windows PowerShell credential object (PSCredential object) by prompting the user for the user name and password that are required to join a computer to the domain.##################################################################### Define a function to create a PSCredential object.####################################################################function SecurePass {param([string]$User, [string]$Password)$SPassword = New-Object System.Security.SecureStringfor ($i=0; $i -lt $Password.Length; $i++) {$SPassword.AppendChar($Password[$i])}New-Object System.Management.Automation.PSCredential $User,$SPassword}Connect to the Virtual Machine Manager ServerThe next command in the script AutomateNewVMCreation.ps1 connects to the Virtual Machine Manager server so that subsequent commands can access objects in the Virtual Machine Manager database.The command uses a value stored earlier in $VMMServer (in this case, localhost) to retrieve the server object from the Virtual Machine Manager library and store the server object in variable $C [ Pobierz całość w formacie PDF ]