registrykey

Create Registry Key (and Subkeys)?

[亡魂溺海] 提交于 2019-12-02 13:59:29
I am trying to create a registry key and subkey for enabling IE 11 enterprise mode for all users on a machine. This is what I am using for my VBScript currently and it is failing horribly (does not add the key). I could use some assistance in getting this corrected. Const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set ObjRegistry = _ GetObject("winmgmts:{impersonationLevel = impersonate}! \\" & _ strComputer & "\root\default:StdRegProv") strPath = strKeyPath & "\" & strSubPath strKeyPath = "Software\Policies\Microsoft" strSubPath = "Internet Explorer\Main\EnterpriseMode" strName =

Update registry using VBS

谁说胖子不能爱 提交于 2019-12-02 06:40:51
问题 I'm trying to update the legal caption on our PCs using a VBScript. So far, I've been able to read values but I can't seem to get it to write any values. I don't get an error when I run the script, it just doesn't change anything. It's the first time I'm doing this and I have limited experience; any insight would be appreciated: Dim objShell Dim strMessage, strWelcome, strWinLogon ' Set the string values strWelcome = "legalnoticecaption" strMessage = "did this work" strWinLogon = "HKLM

Registry value with quotes

╄→尐↘猪︶ㄣ 提交于 2019-12-02 06:35:55
问题 I need to insert a value into registry in a batch file. The value contains quotes and that makes it hard to insert. set OPENCOMMAND="\"%JAVAHOME%\bin\javaw.exe\" -jar \"%%1\" %%*\"" reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\jarfile\shell\open\command" /v "" /t REG_SZ /d %OPENCOMMAND% This results almost in the correct result except that the value contains quotes around it in the reqistry. "C:\Program Files\Java\jre7\bin\javaw.exe" -jar "%1" %*" That's what the registry contains and what it

Registry value with quotes

不问归期 提交于 2019-12-02 03:39:57
I need to insert a value into registry in a batch file. The value contains quotes and that makes it hard to insert. set OPENCOMMAND="\"%JAVAHOME%\bin\javaw.exe\" -jar \"%%1\" %%*\"" reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\jarfile\shell\open\command" /v "" /t REG_SZ /d %OPENCOMMAND% This results almost in the correct result except that the value contains quotes around it in the reqistry. "C:\Program Files\Java\jre7\bin\javaw.exe" -jar "%1" %*" That's what the registry contains and what it should contain is C:\Program Files\Java\jre7\bin\javaw.exe" -jar "%1" %* What to do? This script

Update registry using VBS

╄→гoц情女王★ 提交于 2019-12-02 01:17:08
I'm trying to update the legal caption on our PCs using a VBScript. So far, I've been able to read values but I can't seem to get it to write any values. I don't get an error when I run the script, it just doesn't change anything. It's the first time I'm doing this and I have limited experience; any insight would be appreciated: Dim objShell Dim strMessage, strWelcome, strWinLogon ' Set the string values strWelcome = "legalnoticecaption" strMessage = "did this work" strWinLogon = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\" ' Create the Shell object Set wshShell =

C# Registry SetValue throws UnauthorizedAccessException

只谈情不闲聊 提交于 2019-12-01 16:19:34
Before you try to answer this with, "Do a quick Google search." I'd like to point out that I have already. Here is the situation, I have the following method that attempts to modify a registry key value. The problem I'm getting is that when executed, it throws an UnauthorizedAccessException even though I've opened the key as writeable . I'm running Visual Studio as administrator and even tried to make a small .exe with a manifest file forcing it to run as admin that will execute the code with no luck. The key already exists, it doesn't try to go into the CreateKey method. Here is the block of

Write a Stringformated Hex Block to registry in Binary value

巧了我就是萌 提交于 2019-12-01 09:22:47
问题 I am really get stucked with something. I have a string which includes hex values: string creatorSid = @"01,05,00,00,00,00,00,05,15,00,00,00,10,b1,9d,4a,7a,85,7b,05, 79,05,b3,7c,ee,03,00,00"; I want to put that into the registrykey which requires binary values. I tried this: key.SetValue("creatorSID", creatorSid , RegistryValueKind.Binary); But I got error message that it can not be converted. Here is the complete Code so far: class Program { static void Main(string[] args) { String

Read Registry_binary and convert to string

▼魔方 西西 提交于 2019-11-30 23:41:47
I have been searching for the last 2 hours, and I actualy just have been searching stupid. I am trying to read a Registry_binary Value and convert this to a string. I tried several things I've found online(includeing some stackoverflow posts), but seems I cannot get it work: class Class1 { RegistryKey RegKey; String keys; static void Main() { Class1 c=new Class1(); c.initialize(); } void initialize() { RegKey=Registry.LocalMachine.OpenSubKey("the location", true); var bytearray=Converter<RegKey.GetValue("key"), String[keys]>; Console.WriteLine(bytearray); System.Threading.Thread.Sleep(5000); }

I added a registry key, but I cannot find it programmatically

。_饼干妹妹 提交于 2019-11-29 14:16:36
So I used RegEdit to add the following to the registry on my workstation: HKLM\Software\Foo\Bar Bar has a k/v pair of "wtf"/"idk". I verified that these changes "took" by closing regedit and re-opening it. Hey, they're still there! Swell. RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Foo\Bar"); if (key != null) { var = key.GetValue("wtf").ToString(); } The problem is, key is null. When. . . Registry.LocalMachine.OpenSubKey("Software").GetSubKeyNames() Is called, Foo doesn't show up amongst the however many SubKeyNames. So, I am obviously missing something stupid. What

Read and write from/to registry in VBA

旧时模样 提交于 2019-11-29 10:57:48
I saw this line in C# and I am trying to adapt it to VBA: Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 4,Microsoft.Win32.RegistryValueKind.DWord); I'm quite lost here with some error: Runtime: 5 - invalid procedure call) When I use the default i_Type string "REG_SZ" instead of "Start", then I get a regkey related error: Runtime - -2147024891[80070005] invalid root My code: Dim i_RegKey As String, i_Value As String, i_Type As String Dim myWS As Object i_Type = "REG_SZ" ' Optional 'access Windows scripting Set myWS = CreateObject(