VMM服务模板(虚机、APP)部署排错

I won't focus this blog on how to create a service template but more on how you can track the changes that happen behind the scenes to troubleshoot any issues.

Let's first create a scenario.  For simplicity sake, we will use a single VM as this will help us understand the process and use it to track any other deployment. The service template will create a VM with Windows Server 2008 R2 SP1, install the Server App-V agent and then import a Server App-V package to the server.

Once you go through the deployment process and the job starts in the background, this is what occurs:

1) The VHD is transferred from the library to the host via BITS. This process is similar to creating a VM from a template.

2) Once the VM is created on the host, the process will add a virtual floppy to apply all the customization provided in the OS configuration of the template. This will include the addition of roles and features. You can view steps 1 and 2 by connecting to the VM using Hyper-V.

clip_image002

clip_image004

Once SysPrep is complete, the VM is domain joined and running the process that will install a guest VMM agent. You can confirm that this process occurred by connecting to the VM and navigating to %programdata%vmmlogs. The guest agent will serve as the listener to the SCVMM service to perform actions on the guest VM.

    SCVMM 2012 R2的VMM Agent目录如下:

    C:Program FilesMicrosoft System Center 2012 R2Virtual Machine Manager Guest Agent R2inDiagnostics (该目录下有VMMGuestlog.svclog)

3) Once the agent is installed it will proceed to run scripts in the VM, but before it runs these scripts it needs to transfer them to the guest VM. This step allows you to restart the job if an error occurs. This is done by transferring the custom resource folder from the library to the VM and these files are stored under c:windows emp under a folder called scvmmxxxxxx.cr folder.

clip_image006

clip_image008

4) Once the script files are copied, the Server App-V agent install script will launch the script using c:windows emp as its working directory. Here it will create two files named GCE_stderrorXXX and GCE_stdoutXXX. These are text files that capture the output of the running script. The GCE_stdoutxxx contains the information of the current actions being performed by the process and the GCE_stderrorxxx file will have any error encountered by the script. If the script encounters an error and stops the process, it will leave this last log in the directory for review. If the process completes successfully it deletes all the contents inside windows emp

clip_image010

5) Assuming that the process succeeds, we then proceed to transfer the application files specified in the application section of the template. In this case, this is a Server App-V package so it will transfer the package files from the library and store them in the local drive. These files will be stored in c:windowsMSSCVMMApplications.

Inside this folder you will have two additional folders. One is for Server App-V and it’s here that we store our App-V files. The other is a Webdeploy folder that will store any web apps you have specified in the template.

clip_image012

Since we are using Server App-V, it will launch all PowerShell command to import the application into the Server App-V cache.

NOTE If we were installing a SQL dacpack, the files will be deployed to c:windows MSSCVMMSQLInstance

If the process was successful, you will see the Server App-V application running a service or an icon on the Server App-V agent application list.

The service template process will store logs in c:programdataMicrosoftVirtual Machine Manager to track the process of an application installation.

clip_image014

Sample entry of a VMMapplicationmanager.log:

clip_image016

If you are configuring a SQL instance in the service template as part of your deployment, you can gather SQL logs by going to c:program filesMicrosoft SQL Server100Setup Bootstraplog and look in Summary.txt for errors or failures.

clip_image018

通过作业(详细信息)查看失败日志,重新启动作业后成功:

From:http://blogs.technet.com/b/scvmm/archive/2012/04/19/troubleshooting-service-templates-in-system-center-2012-virtual-machine-manager.aspx

原文地址:https://www.cnblogs.com/dreamer-fish/p/3442165.html