我使用以下代碼創建Windows註冊表項。無法在Windows註冊表中寫入適當的位置
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKLM\Software\NewsReader\ConnectionString1", "Server=myServerName3\myInstanceName1;Database=myDataBase1;User Id=myUsername1;Password=myPassword1;", "REG_SZ"
Set WshShell = Nothing
不知怎的,它在錯誤的地方寫。
HKEY_USERS\S-1-5-21-3289046681-1693842953-402210132-1123\Software\Classes\VirtualStore\MACHINE\SOFTWARE\NewsReader
我在管理域帳戶下執行該腳本,並且該帳戶本地具有管理權限。
我在這裏錯過了什麼?
P.S.我發現這Why is registry written in different location than expected?,但它不清楚我如何更改我的代碼...
見http://www.server-world.info/en/note?os=Other&p=vbs也http://stackoverflow.com/questions/17466681/how-to-run-vbs-作爲管理員從 - VBS – klugerama