Could not see VM created in the Citrix DaaS & Azure (Azure Image Gallery) as it keep going in power off state immediately when attempting to boot
- Unable to see VM [OsDisk] in the Azure Portal
- Only Identity Disk & NIC card is getting created in the Azure Portal
Overview
========
Download Remote PowerShell SDK & access their Cloud Tenant
Remove the ImageManagementPrep_DoImagePreparation = $False and any other configurations outside the default config.
Enabled the logging for the PrepVM
Unable to access PrepVM (via RDP or bastion due to Security)
We took a snapshot of the PrepVM -> Created a Drive out of the snapshot -> Added the drive to an existing VM to review
Detailed Steps
===========
** First Download the Remote Powershell SDK: https://www.citrix.com/downloads/citrix-cloud/product-software/xenapp-and-xendesktop-service.html
** Install on a VM on the internal Network (However do not install on Cloud Connectors)
** Launch the PowerShell SDK in elevated mode (Run as admin)
i. Run the following commands
ii. ASNP Citrix*
iii. GET-XDAuthentication
** Once prompted & you successfully entered your Cloud Credentials - Proceed with the following commands:
------------------------------------------------------------------------------------------------------------------------------------------------
Posh:> Remove-ProvServiceConfigurationData -Name ImageManagementPrep_DoImagePreparation
On the Master Image VM
==================
Under HKLM\Software\Citrix\MachineIdentityServiceAgent
Use the updated Azure Image Gallery version to create a new Catalog
==========================================================
You will see on the Azure side a VM ("Imageprep_xxxxxxx")
Using the ImagePrep.log
====================
Identify what is the real issue occurring during the Image preparation (in our case there was a re-arm issue with the OS & MS Office)
Options
======
1) Mask the issue (by excluding the Rearming of the OS & Office from the image preparation process)
Using the Remote Powershell SDK:
--------------------------------------------
Posh:> Remove-ProvServiceConfigurationData -Name ImageManagementPrep_DoImagePreparation
Posh:> Set-ProvServiceConfigurationData -Name ImageManagementPrep_Excluded_Steps -Value "OsRearm,OfficeRearm"
** Validate the changes are set correctly by using the command [ Get-ProvServiceConfigurationData ] **
** Then remove after creating the new Catalog (as this affects globally anyone trying to create a new catalog on your Citrix Cloud tenant **
Using the Remote Powershell SDK:
--------------------------------------------
Posh:> Remove-ProvServiceConfigurationData -Name ImageManagementPrep_Excluded_Steps
2) Resolve the O.S & Office related issue on your Master Image
Re-arming Issues, these Issues usually lie on the Windows Side:
===================================================
Permissions & WMI related issues
A) Use the WMI Classes to confirm that the software [SoftwareLicensingService] exists & retails like ClientMachineID, LicenseStatus, etc.
- ClientMachineID is tied to Windows activation. If the OS is not properly activated, this field may be empty.
Posh:> Get-WmiObject -Namespace "root\cimv2" -Class SoftwareLicensingService
Posh:> Get-WmiObject -Namespace "root\cimv2" -List | Where-Object { $_.Name -like "Software" }
B) Registry Permissions are as follows:
- HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\SOFTWAREPROTECTIONPLATFORM
- Security >Group or Username [SYSTEM] - has Permissions (FULL CONTROL & READ)
- HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\SOFTWAREPROTECTIONPLATFORM
- Security > Group or Username [Administartors] - has Permissions (FULL CONTROL & READ)
C) Run this command to check activation status:
slmgr /dlv
Click OK and restart the Windows Management Instrumentation (WMI) service:
net stop winmgmt
net start winmgmt
Ensure that the WMI repo is not corrupt:
winmgmt /verifyrepository
Reset WMI repository:
winmgmt /resetrepository
Then, restart WMI:
net stop winmgmt
net start winmgmt
Restart the Software Protection Service:
net stop sppsvc
net start sppsvc
Verify rearm count:
slmgr /dlv
If the remaining rearm count is 0, you may need to rearm manually before image preparation.
If rearm count is exhausted, reset it using a sysprep workaround:
slmgr /rearm
shutdown -s -t 0
Upon checking the customers Cloud Tenant [ ProvServiceConfiguration ] details
When you skip the Image preparation, it cannot find the appropriate Source ID (location of the Azure Image Gallery)
Error,"[AzPv_1]: Plug-in threw MachineCreationException within custom PowerOnWithBaseDiskReset operation: Citrix.MachineCreationAPI.MachineCreationException: Error starting machine. Invalid source id: azvmxxxx/WindowsServerGallery_Citrix/VDA-Definition/xxxx.
The VM Preparation is skipped (skipping all the checks along with it [OfficeRearm, EnableDHCP, PrepareMSMQ, OsRearm, PrepJoinDomain, RequirePvd, RequireWbc, AppScanning] )
Upon revert the ImagePreparation to default & access the PrepVM logs (we could see two issues)
1) Office is installed and rearm tool is present at 'C:\Program Files\Microsoft Office\Office16\OSPPREARM.EXE', executing
Office rearm tool completed, exit code -2147024891
Office Rearm process failed. Message=Office rearm failed: error code 0x80070005
2) Rearming Windows
Caught exception in rearm Windows. System.UnauthorizedAccessException
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Management.ManagementObject.InvokeMethod(String methodName, ManagementBaseObject inParameters,
InvokeMethodOptions options)
at Citrix.MachineCreation.ImagePreparation.SoftwareLicensingService.ReArmWindows()
at Citrix.MachineCreation.ImagePreparation.ImagePreparation.RearmWindows(PreparationResults results)