Working with Citrix Provisioning Server, you may have encountered the issue of having a "Found New Hardware" prompt when using Cache on Device Hard Disk.
When provisioning XenApp Servers, this issue's impact is minimized because only Administrators can see the popup.
When it comes to provisioned Desktops, all users are seing the message at every logon, so it's important to find a way to fix it.
Citrix is providing an old Ardence Tool to manage this issue but in somes cases it does not work.
The prompt is related to a new Hard Disk Signature found (actually the Local HD used for cache) and detected as a new hardware by the system.
To detect an Hard Disk, Windows is using a Disk Signature that is stored into the registry. If a new signature is detected, then the prompt is raised.
To overcome this issue, the solution is to owerwrite the Local HDD signature by another signature, already known by the system.
To do so, I've written a script relying on the mbrfix.exe tool.You can download it on http://www.sysint.no/en/Download.aspx.
To use the following script, you just have to replace the mbrfix.exe path and setup your cache volume name along with the disk signature you want to write.
You'll then have to run the script once within your image in private mode and then at each shared image boot.
'------------------------------------------------------------------------------------
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
Const MbrFixPath = "Insert MbrFix.exe Path"
Const FixedDiskSig = "f000000f"
Const CacheVolumeName = "PVS_Cache"
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set objShell = Wscript.CreateObject("Wscript.Shell")
Main()
Sub Main()
On Error Resume Next
Err.Clear
If VolumeCacheExist then
If not SelectFirstPhysicalDiskIndex() = -1 then
RewriteDiskSignature(SelectFirstPhysicalDiskIndex())
WriteLog 0,"FixCacheDiskSig.vbs : Disk Signature Rewrite finished"
Else
WriteLog 2,"FixCacheDiskSig.vbs : Disk Signature Rewrite skipped : No Physical Disk Found"
End If
Else
WriteLog 2,"FixCacheDiskSig.vbs : Disk Signature Rewrite skipped : No Cache Volume Found"
End If
End Sub
Function VolumeCacheExist()
On Error Resume Next
VolumeCacheExist = False
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk WHERE VolumeName = " & CacheVolumeName, "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
VolumeCacheExist = True
Next
End Function
Function SelectFirstPhysicalDiskIndex()
On Error Resume Next
SelectFirstPhysicalDiskIndex = -1
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive WHERE Caption <> 'Citrix Virtual HBA SCSI Disk Device' AND Caption <> 'Citrix Virtual Hard Disk'", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
SelectFirstPhysicalDiskIndex = objItem.Index
Exit For
Next
End Function
Sub RewriteDiskSignature(DiskIndex)
On Error Resume Next
set oEnv = objShell.Environment("PROCESS")
oEnv("SEE_MASK_NOZONECHECKS") = 1
Cmd1 = MbrFixPath & Space(1) & "/drive" & Space(1) & DiskIndex & Space(1) & "writesignature" & Space(1) & FixedDiskSig & Space(1) & "/yes"
RunHiddenAndReturn Cmd1
oEnv.Remove("SEE_MASK_NOZONECHECKS")
Set oEnv = Nothing
Set Wshell = Nothing
Set oShell = Nothing
End Sub
Private Sub RunHiddenAndReturn(cmd)
on error resume next
err.clear
objShell.run cmd , 0 , True
if err then
WriteLog 2,"FixCacheDiskSig.vbs : RunHiddenAndReturn: ERROR: " & err.number & " -> " & err.description
else
writeLog 0,"FixCacheDiskSig.vbs : RunHiddenAndReturn: OK: " & cmd
end if
End Sub
Sub WriteLog(evType,msg)
on error resume next
objShell.LogEvent evType, msg
End Sub
'------------------------------------------------------------------------------------