CitrixTools.Net Articles

Current Articles | Categories | Search | Syndication

Get rid of the "Found New Hardware" Prompt when using Device HardDisk Cache

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
 

'------------------------------------------------------------------------------------

posted on Sunday, August 16, 2009 3:43 PM by Pierre Marmignon    

Previous Page | Next Page

COMMENTS

Hi Pierre, I found your script on a citrix forum and I've put it in place but not having much luck. I was hoping you could give my further instructions.

Here's what I've done so far.
I downloaded mbrfix.exe and placed it on c: drive.
I then copied your script into a vbs file and used gpedit to run it at startup.
I changed the location of the mbrfix.exe in your script to the c:' drive.
I ran the script once on the image in private mode.
Then changed the image to standard with local disk cache.

I'm still getting the same found new hardware message.

Is there anything that I'm missing. Thanks for any help.

posted @ Tuesday, October 26, 2010 9:55 PM by bdw


I'm also experiencing this issue with PVS and Windows 7 - any chance of an updated script?

posted @ Saturday, November 06, 2010 5:01 PM by caustic386


Only registered users may post comments.