2016-02-24 68 views
0

我想枚举一些使用VBScript的注册表项的实际值,但运行到一个奇怪的问题。枚举值而不是注册表项名

这从以前的子脚本正常工作,并停放与'''''''''''''''''''点脚本检索每个子项的实际值:

strOfficePath = "Software\Microsoft\Office\15.0\" 
strKeysuffix = "\Resiliency\DisabledItems\" 
objReg.EnumKey conHKEY_CURRENT_USER, strOfficePath, arrOfficeSubKeys 

For Each key in arrOfficeSubKeys 
    If regExists("HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\" & key & strKeysuffix) Then 
     objReg.EnumValues conHKEY_CURRENT_USER, strOfficePath & key & strKeysuffix, arrKeyValues 
     For Each value in arrKeyValues 
     ''''''''''''''''''''' 
      If value <> "" Then 
       objShell.RegDelete "HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\" & key & "\Resiliency\DisabledItems\" & value 
      End If 
     Next 
    End If 
Next 

然而,在这个剧本,在那里我已经离开了相同标记,我只得到每个子项的名称,但不是实际值的那些键里面...

Dim readreg, strReadPath 

strDazzleSitePath = "Software\Citrix\Dazzle\Sites\" 
objReg.EnumKey conHKEY_CURRENT_USER, strDazzleSitePath, arrDazzleSiteKeys 

For Each key in arrDazzleSiteKeys 

    objReg.EnumValues conHKEY_CURRENT_USER, strDazzleSitePath & key & "\", arrKeyValues 
    For Each value in arrKeyValues 
    ''''''''''''''''''''' 
     Set strReadPath = "HKEY_CURRENT_USER\Software\Citrix\Dazzle\Sites\" & key & "\" & value  
     Set readreg = objShell.regRead(strReadPath) 

     If instr(readreg, "XenApp7") Then 
      ' Log the user name etc somewhere 
      Exit Sub 
     End If 
    Next 
Next 

能有人请解释这到底是怎么回事呢?

回答

0

我仍然不知道发生了什么事情就到这里,但我这个解决它:

On Error Resume Next 
Dim readreg, strReadPath 

strDazzleSitePath = "Software\Citrix\Dazzle\Sites\" 
objReg.EnumKey conHKEY_CURRENT_USER, strDazzleSitePath, arrDazzleSiteKeys 

For Each key in arrDazzleSiteKeys 

    objReg.EnumValues conHKEY_CURRENT_USER, strDazzleSitePath & key, arrKeyValues 
    For Each value in arrKeyValues 

     objReg.GetStringValue conHKEY_CURRENT_USER, strDazzleSitePath & key, value, strValue 

     If instr(strValue, "XenApp7") Then 
      ' Log the user name etc somewhere 
      Exit Sub 
     End If 
    Next 
Next 

现在strValue中包含的每个子项值的字符串值。

相关问题