2016-09-23 18 views
0

新的VBS,基本上符合標準,腳本將編輯註冊表,這是我到目前爲止。VBS沒有調用regedit對象

For Each ObjProcessor In ColSettings 
If (ObjProcessor.AddressWidth = 64) Then 
    If FSO.FileExists("C:\Program Files (x86)\A\A Client\B\SelfService.exe") Then 
     strkey1 = WshShell.RegRead("HKLM\SOFTWARE\Wow6432Node\A\B\C\STORE0") 
     If (strkey1 = "AppGateway;https://A.net/C/B/Discovery;On;AppGateway") Then 
      Set objRegistry = GetObject("winmgmts:\\" & strComputer &"\root\default:StdRegProv") 
      strKeyPath = "SOFTWARE\Wow6432Node\A\B\C\" 
      strValueName = "STORE0" 
      objRegistry.DeleteValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName 
      Call MsgBox("Test: " & strKeyPath) 
     End If 
    End If 
End If 
Next 

因此,只有MsgBox函數工作時,objRegistry.DeleteValue心不是。我之前已經宣佈過objRegistry。不能似乎弄清楚爲什麼

+4

確保登錄用戶具有註冊表項的權限。 –

+0

d0h大聲笑...不能相信我錯過了最基本的東西。欣賞...但是我現在有一個更大的問題。 – Farhan

回答

3

登錄用戶應該有權限的註冊表項。 根據@Farhan的評論,他知道了原因。提出答案,因爲它會幫助其他有類似問題的人。

相關問題