Search Results

Search found 53 results on 3 pages for 'registrykey'.

Page 1/3 | 1 2 3  | Next Page >

  • RegistryKey ValueCount/SubKeyCount wrong

    - by Mark J Miller
    I am trying to query the following registry key values: HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\SharedMemoryOn HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\SuperSocketNetLib\ProtocolOrder But depending on which machine I'm running the program the query returns null. When I debug on my local machine and I inspect the value for ValueCount for: HKLM\SOFTWARE\Microsoft\MSSQLServer\Client HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\SuperSocketNetLib The count is 0 and OpenSubKey returns null. I am a domain admin, in the local administrators group and have added the following to my app.manifest: <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> Any idea why? private static void ValidateSqlClientSettings() { Console.WriteLine("\r\n/////////////// LOCAL SQL CLIENT PROTOCOLS ////////////////"); RegistryKey keyHKLM = Registry.LocalMachine; ///TODO: nullreferenceexception - connect to remote machine and find out why RegistryKey sqlClientKey = keyHKLM.OpenSubKey(@"SOFTWARE\Microsoft\MSSQLServer\Client"); if (sqlClientKey == null) { WriteLine2Console(@"WARNING: unable to read registry key '{0}\SOFTWARE\Microsoft\MSSQLServer\Client'", ConsoleColor.Yellow); } var cliKeyNames = from k in sqlClientKey.GetSubKeyNames() where k == "SuperSocketNetLib" select k; ///TODO: find out why these values are always missing (even if I can see them in regedit) Console.Write("Shared Memory Disabled (cliconfg): "); if (Convert.ToBoolean(sqlClientKey.GetValue("SharedMemoryOn"))) WriteLine2Console("FAILED", ConsoleColor.Red); else if(sqlClientKey.GetValue("SharedMemoryOn") == null) WriteLine2Console(String.Format("WARNING - unable to read '{0}\\SharedMemoryOn'", sqlClientKey.Name), ConsoleColor.Yellow); else WriteLine2Console("PASS", ConsoleColor.Green); Console.Write("Client Protocol Order (cliconfg - tcp first): "); foreach (string cliKey in cliKeyNames) { RegistryKey subKey = sqlClientKey.OpenSubKey(cliKey); object order = subKey.GetValue("ProtocolOrder"); if (order != null && order.ToString().StartsWith("tcp") == false) { WriteLine2Console("FAILED", ConsoleColor.Red); } else if (order == null) { WriteLine2Console(String.Format("WARNING - unable to read '{0}\\ProtocolOrder'", subKey.Name), ConsoleColor.Yellow); } else { WriteLine2Console("PASS", ConsoleColor.Green); } subKey.Close(); } sqlClientKey.Close(); keyHKLM.Close(); }

    Read the article

  • How do I pass credentials to a machine so I can use Microsoft.Win32.RegistryKey.OpenRemoteBaseKey()

    - by JCCyC
    This .NET API works OK if I'm trying to open the Registry in a machine that's in the same domain as I am (and my logged-on user has admin rights on the target machine). It gets tricky if it's an out-of-domain machine with a different, local administrative user (of whom I do have the password). I tried to use WNetUseConnection() (which has served me well in the past in situations where what I wanted was to read a remote disk file) prior to calling OpenRemoteBaseKey(), but no dice -- I get an access denied exception. Clearly, I must pass credentials some other way, but how?

    Read the article

  • C# Count registry keys existing using a partial value

    - by cheeseman
    Microsoft.Win32.RegistryKey registryPath = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Testing"); Microsoft.Win32.RegistryKey entryKey = registryPath.OpenSubKey("Entry Point"); I have a lot of keys in Testing, in the format: "Entry Point 011", "Entry Point 123" - so Entry Point with random numbers after it. Would I be able to search the registryPath variable above and get a count of the number of keys containing the "Entry Point" keyword? Assuming that there are also other keys existing without this keyword. At the moment I have been using a for loop and looping for all possible combinations to get a count of all the keys, checking if the key exists or not, but as there are keys as high as "Entry Point 9000" having a for loop execute 9000 times is very inefficient. for (int i = 0; i <= highestEntryPointValue; i++) { Microsoft.Win32.RegistryKey entryKey = steamApps64.OpenSubKey("Entry Point " + Convert.ToString(i)); if (entryKey != null) { count++; } }

    Read the article

  • deleting registry key, using Visual Studio 2008 setup and deployment project in windows 7

    - by Isuru
    I have created a setup and deployment project in Visual Studio 2008 Professional. I'm using Visual C++, and in it I have two exe files which run under custom actions. One is running in commit and other in uninstall. Purpose is to add a registry key at install time and remove it at uninstall. It works perfectly on Windows XP but when I change to Windows 7 and run the setup, only the key-adding part works. The key doesn't get deleted at uninstall. But when I take the uninstall exe file out from the setup and run it separately on Windows 7, (not through the setup, by just double-clicking on the exe) it removes the registry entry perfectly. Any idea what the problem is?

    Read the article

  • deleting registry key, using visual stusdio 2008 setup and deployment project in windows 7

    - by Isuru
    Hi, I have created a setup and deployment project in visual studio 2008 pro. using visual C++, and in it I have two exe files which run under custom actions. One is running in commit and other in uninstall. Purpose is to add a registry key at install time and remove it at uninstall. It works perfectly on Windows XP but when I change to Windows 7 and run the setup, only the key-adding part works. The key doesn't get deleted at uninstall. But when I take the uninstall exe file out from the setup and run it separately on Windows 7, (not through the setup, by just double-clicking on the exe) it removes the registry entry perfectly. Any idea what the problem is??? Thanks and Regards.

    Read the article

  • UnauthorizedAccessException in ComRegisterFunction when accessing registry on Win 7 64.

    - by sanbornc
    I have a [ComRegisterFunction] that I am using to register a BHO Internet explorer extension. During registration on 64-bit windows 7 machines, a UnauthorizedAccessException is thrown on the call to subKey.SetValue("NoExplorer", 1). The registry appears to have BHO's located @ \HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\explorer\Browser Helper Objects, however, I get them same exception when trying to register there. Any Help would be appreciated. [ComRegisterFunction] public static void RegisterBho(Type type) { string BhoKeyName= "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Browser Helper Objects"; RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(BhoKeyName, true) ?? Registry.LocalMachine.CreateSubKey(BhoKeyName); if(registryKey == null) throw new ApplicationException("Unable to register Bho"); registryKey.Flush(); string guid = type.GUID.ToString("B"); RegistryKey subKey = registryKey.OpenSubKey(guid) ?? registryKey.CreateSubKey(guid); if (subKey == null) throw new ApplicationException("Unable to register Bho"); subKey.SetValue("NoExplorer", 1); registryKey.Close(); subKey.Close(); }

    Read the article

  • how to create registry key through java program?

    - by Arivu2020
    I want to create registry key through java program to add the jar file in the start up. RegistryKey r=new RegistryKey(RootKey.HKEY_CURRENT_USER,"Software/Microsoft/Windows/CurrentVersion/Run"); r.createSubkey("sample"); But i got the error: Exception in thread "main" java.lang.UnsatisfiedLinkError: ca.beq.util.win32.registry.RegistryKey.testInitialized()V at ca.beq.util.win32.registry.RegistryKey.testInitialized(Native Method) How can i do that? Thanks

    Read the article

  • One registry key for many products not deleted on uninstall

    - by NC1
    My company has many products, we want to create a registry key Software\$(var.Manufacturer)that will have all of our products if our customers have installed more than one (which is likely) I then want to have a secondary key for each of our products which get removed on uninstall but the main one does not. I have tried to achieve this like below but my main key gets deleted so all of my other products also get deleted from the registry. I know this is trivial but I cannot find an answer. <DirectoryRef Id="TARGETDIR"> <Component Id="Registry" Guid="*" MultiInstance="yes" Permanent="yes"> <RegistryKey Root="HKLM" Key="Software\$(var.Manufacturer)" ForceCreateOnInstall="yes"> <RegistryValue Type="string" Name="Default" Value="true" KeyPath="yes"/> </RegistryKey> </Component> </DirectoryRef> <DirectoryRef Id="TARGETDIR"> <Component Id="RegistryEntries" Guid="*" MultiInstance="yes" > <RegistryKey Root="HKLM" Key="Software\$(var.Manufacturer)\[PRODUCTNAME]" Action="createAndRemoveOnUninstall"> <RegistryValue Type="string" Name="Installed" Value="true" KeyPath="yes"/> <RegistryValue Type="string" Name="ProductName" Value="[PRODUCTNAME]"/> </RegistryKey> </Component> </DirectoryRef> EDIT: I have got my registry keys to stay using the following code. However they only all delete wen all products are deleted, not one by one as they need to. <DirectoryRef Id="TARGETDIR"> <Component Id="Registry" Guid="FF75CA48-27DE-430E-B78F-A1DC9468D699" Permanent="yes" Shared="yes" Win64="$(var.Win64)"> <RegistryKey Root="HKLM" Key="Software\$(var.Manufacturer)" ForceCreateOnInstall="yes"> <RegistryValue Type="string" Name="Default" Value="true" KeyPath="yes"/> </RegistryKey> </Component> </DirectoryRef> <DirectoryRef Id="TARGETDIR"> <Component Id="RegistryEntries" Guid="D94FA576-970F-4503-B6C6-BA6FBEF8A60A" Win64="$(var.Win64)" > <RegistryKey Root="HKLM" Key="Software\$(var.Manufacturer)\[PRODUCTNAME]" ForceDeleteOnUninstall="yes"> <RegistryValue Type="string" Name="Installed" Value="true" KeyPath="yes"/> <RegistryValue Type="string" Name="ProductName" Value="[PRODUCTNAME]"/> </RegistryKey> </Component> </DirectoryRef>

    Read the article

  • RegLoadAppKey working fine on 32-bit OS, failing on 64-bit OS, even if both processes are 32-bit

    - by James Manning
    I'm using .NET 4 and the new RegistryKey.FromHandle call so I can take the hKey I get from opening a registry file with RegLoadAppKey and operate on it with the existing managed API. I thought at first it was just a matter of a busted DllImport and my call had an invalid type in the params or a missing MarshalAs or whatever, but looking at other registry functions and their DllImport declarations (for instance, on pinvoke.net), I don't see what else to try (I've had hKey returned as both int and IntPtr, both worked on 32-bit OS and fail on 64-bit OS) I've got it down to as simple a repro case as I can - it just tries to create a 'random' subkey then write a value to it. It works fine on my Win7 x86 box and fails on Win7 x64 and 2008 R2 x64, even when it's still a 32-bit process, even run from a 32-bit cmd prompt. EDIT: It also fails in the same way if it's a 64-bit process. on Win7 x86: INFO: Running as Admin in 32-bit process on 32-bit OS Was able to create Microsoft\Windows\CurrentVersion\RunOnceEx\a95b1bbf-7a04-4707-bcca-6aee6afbfab7 and write a value under it on Win7 x64, as 32-bit: INFO: Running as Admin in 32-bit process on 64-bit OS Unhandled Exception: System.UnauthorizedAccessException: Access to the registry key '\Microsoft\Windows\CurrentVersion\RunOnceEx\ce6d5ff6-c3af-47f7-b3dc-c5a1b9a3cd22' is denied. at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str) at Microsoft.Win32.RegistryKey.CreateSubKeyInternal(String subkey, RegistryKeyPermissionCheck permissionCheck, Object registrySecurityObj, RegistryOptions registryOptions) at Microsoft.Win32.RegistryKey.CreateSubKey(String subkey) at LoadAppKeyAndModify.Program.Main(String[] args) on Win7 x64, as 64-bit: INFO: Running as Admin in 64-bit process on 64-bit OS Unhandled Exception: System.UnauthorizedAccessException: Access to the registry key '\Microsoft\Windows\CurrentVersion\RunOnceEx\43bc857d-7d07-499c-8070-574d6732c130' is denied. at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str) at Microsoft.Win32.RegistryKey.CreateSubKeyInternal(String subkey, RegistryKeyPermissionCheck permissionCheck, Object registrySecurityObj, RegistryOptions registryOptions) at Microsoft.Win32.RegistryKey.CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck) at LoadAppKeyAndModify.Program.Main(String[] args) source: class Program { static void Main(string[] args) { Console.WriteLine("INFO: Running as {0} in {1}-bit process on {2}-bit OS", new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator) ? "Admin" : "Normal User", Environment.Is64BitProcess ? 64 : 32, Environment.Is64BitOperatingSystem ? 64 : 32); if (args.Length != 1) { throw new ApplicationException("Need 1 argument - path to the software hive file on disk"); } string softwareHiveFile = Path.GetFullPath(args[0]); if (File.Exists(softwareHiveFile) == false) { throw new ApplicationException("Specified file does not exist: " + softwareHiveFile); } // pick a random subkey so it doesn't already exist var keyPathToCreate = "Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\" + Guid.NewGuid(); var hKey = RegistryNativeMethods.RegLoadAppKey(softwareHiveFile); using (var safeRegistryHandle = new SafeRegistryHandle(new IntPtr(hKey), true)) using (var appKey = RegistryKey.FromHandle(safeRegistryHandle)) using (var runOnceExKey = appKey.CreateSubKey(keyPathToCreate)) { runOnceExKey.SetValue("foo", "bar"); Console.WriteLine("Was able to create {0} and write a value under it", keyPathToCreate); } } } internal static class RegistryNativeMethods { [Flags] public enum RegSAM { AllAccess = 0x000f003f } private const int REG_PROCESS_APPKEY = 0x00000001; // approximated from pinvoke.net's RegLoadKey and RegOpenKey // NOTE: changed return from long to int so we could do Win32Exception on it [DllImport("advapi32.dll", SetLastError = true)] private static extern int RegLoadAppKey(String hiveFile, out int hKey, RegSAM samDesired, int options, int reserved); public static int RegLoadAppKey(String hiveFile) { int hKey; int rc = RegLoadAppKey(hiveFile, out hKey, RegSAM.AllAccess, REG_PROCESS_APPKEY, 0); if (rc != 0) { throw new Win32Exception(rc, "Failed during RegLoadAppKey of file " + hiveFile); } return hKey; } }

    Read the article

  • Simple Little Registry Editor - New Release

    - by Bruce Eitman
    I have posted a new release of the Simple Little Registry Editor found in Windows CE: Simple Little Registry Editor.  This release fixes a problem with writing DWORD values when the most significant bit is set.  The application uses RegistryKey.SetValue.  There seems to be a problem with how the .NET CompactFramework (and the full framework) handle the second argument during the call which causes an exception. So the following does not work: RegistryKey.SetValue( "TestValue", 0xFFFFFFFF, RegistryValueKind.DWord ); But, this does: RegistryKey.SetValue( "TestValue",unchecked((int) 0xFFFFFFFF), RegistryValueKind.DWord ); Copyright © 2012 – Bruce Eitman All Rights Reserved

    Read the article

  • Is there an easier way of creating a registry volatile subkey in .net?

    - by Simon
    So far I have the below which is taken from http://www.danielmoth.com/Blog/volatile-registrykey.aspx public static class RegistryHelper { public static RegistryKey CreateVolatileSubKey(RegistryKey rk, string subkey, RegistryKeyPermissionCheck permissionCheck) { var rk2 = rk.GetType(); const BindingFlags bfStatic = BindingFlags.NonPublic | BindingFlags.Static; const BindingFlags bfInstance = BindingFlags.NonPublic | BindingFlags.Instance; rk2.GetMethod("ValidateKeyName", bfStatic).Invoke(null, new object[] { subkey }); rk2.GetMethod("ValidateKeyMode", bfStatic).Invoke(null, new object[] { permissionCheck }); rk2.GetMethod("EnsureWriteable", bfInstance).Invoke(rk, null); subkey = (string)rk2.GetMethod("FixupName", bfStatic).Invoke(null, new object[] { subkey }); if (!(bool)rk2.GetField("remoteKey", bfInstance).GetValue(rk)) { var key = (RegistryKey)rk2.GetMethod("InternalOpenSubKey", bfInstance, null, new[] { typeof(string), typeof(bool) }, null).Invoke(rk, new object[] { subkey, permissionCheck != RegistryKeyPermissionCheck.ReadSubTree }); if (key != null) { rk2.GetMethod("CheckSubKeyWritePermission", bfInstance).Invoke(rk, new object[] { subkey }); rk2.GetMethod("CheckSubTreePermission", bfInstance).Invoke(rk, new object[] { subkey, permissionCheck }); rk2.GetField("checkMode", bfInstance).SetValue(key, permissionCheck); return key; } } rk2.GetMethod("CheckSubKeyCreatePermission", bfInstance).Invoke(rk, new object[] { subkey }); int lpdwDisposition; IntPtr hkResult; var srh = Type.GetType("Microsoft.Win32.SafeHandles.SafeRegistryHandle"); var temp = rk2.GetField("hkey", bfInstance).GetValue(rk); var rkhkey = (SafeHandleZeroOrMinusOneIsInvalid)temp; var getregistrykeyaccess = (int)rk2.GetMethod("GetRegistryKeyAccess", bfStatic, null, new[] { typeof(bool) }, null).Invoke(null, new object[] { permissionCheck != RegistryKeyPermissionCheck.ReadSubTree }); var errorCode = RegCreateKeyEx(rkhkey, subkey, 0, null, 1, getregistrykeyaccess, IntPtr.Zero, out hkResult, out lpdwDisposition); var keyNameField = rk2.GetField("keyName", bfInstance); var rkkeyName = (string)keyNameField.GetValue(rk); if (errorCode == 0 && hkResult.ToInt32() > 0) { var rkremoteKey = (bool)rk2.GetField("remoteKey", bfInstance).GetValue(rk); var hkResult2 = srh.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, new[] { typeof(IntPtr), typeof(bool) }, null).Invoke(new object[] { hkResult, true }); var key2 = (RegistryKey)rk2.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, new[] { hkResult2.GetType(), typeof(bool), typeof(bool), typeof(bool), typeof(bool) }, null).Invoke(new[] { hkResult2, permissionCheck != RegistryKeyPermissionCheck.ReadSubTree, false, rkremoteKey, false }); rk2.GetMethod("CheckSubTreePermission", bfInstance).Invoke(rk, new object[] { subkey, permissionCheck }); rk2.GetField("checkMode", bfInstance).SetValue(key2, permissionCheck); if (subkey.Length == 0) { keyNameField.SetValue(key2, rkkeyName); } else { keyNameField.SetValue(key2, rkkeyName + @"\" + subkey); } key2.Close(); return rk.OpenSubKey(subkey, true); } if (errorCode != 0) rk2.GetMethod("Win32Error", bfInstance).Invoke(rk, new object[] { errorCode, rkkeyName + @"\" + subkey }); return null; } [DllImport("advapi32.dll", CharSet = CharSet.Auto)] private static extern int RegCreateKeyEx(SafeHandleZeroOrMinusOneIsInvalid hKey, string lpSubKey, int reserved, string lpClass, int dwOptions, int samDesigner, IntPtr lpSecurityAttributes, out IntPtr hkResult, out int lpdwDisposition); } Which works but is fairly ugly. Is there a better way?

    Read the article

  • wix The directory is in the user profile but is not listed in the RemoveFile table

    - by Venkat S. Rao
    I have the following configuration to delete and copy a file from WIX. <Directory Id='TARGETDIR' Name='SourceDir'> ... <Directory Id="AppDataFolder" Name="AppDataFolder"> <Directory Id="GleasonAppData" Name="Gleason" > <Directory Id="GleasonStudioAppData" Name="GleasonStudio"> <Directory Id="DatabaseAppData" Name ="Database"> <Directory Id="UserSandboxesAppData" Name="UserSandboxes" /> </Directory> </Directory> </Directory> </Directory> </Directory> <DirectoryRef Id="UserSandboxesAppData"> <Component Id="comp_deleteBackup" Guid="1f159f49-3029-4f46-b194-e42aabd40844"> <RemoveFile Id="RemoveBackup" Directory="UserSandboxesAppData" Name="DevelopmentBackUp.FDB" On="install" /> <RegistryKey Root="HKCU" Key="Software\Gleason\Database\RemoveBackup"> <RegistryValue Value="Removed" Type="string" KeyPath="yes" /> </RegistryKey> </Component> <Component Id="comp_createBackup" Guid="557badef-6d77-4c4e-aa5f-8d88cb5ef735"> <CopyFile Id="DBBackup" DestinationDirectory="UserSandboxesAppData" DestinationName="DevelopmentBackUp.FDB" SourceDirectory="UserSandboxesAppData" SourceName="Development.FDB" /> <RegistryKey Root="HKCU" Key="Software\Gleason\Database\CopyBackup"> <RegistryValue Value="Copied" Type="string" KeyPath="yes" /> </RegistryKey> </Component> </DirectoryRef> I get 4 errors related to ICE64--The directory 'xxx' is in the user profile but is not listed in the RemoveFile table. xxx={UserSandboxesAppData, DatabaseAppData, GleasonStudioAppData, GleasonAppData} Someone else had a very similar problem here: Directory xx is in the user profile but is not listed in the RemoveFile table. . But that solution did not help me. What do I need to change? Thank You, Venkat Rao

    Read the article

  • Associate File Extension with Application

    - by fneep
    I've written a program that edits a specific filetype , and I want to give the user the option to set my application as the default editor for this filetype (since I don't want an installer) on startup. I've tried to write a re-useable method that associates a file for me (preferably on any OS, although I'm running Vista) by adding a key to HKEY_CLASSES_ROOT, and am using it with my application, but it doesn't seem to work. public static void SetAssociation(string Extension, string KeyName, string OpenWith, string FileDescription) { RegistryKey BaseKey; RegistryKey OpenMethod; RegistryKey Shell; RegistryKey CurrentUser; BaseKey = Registry.ClassesRoot.CreateSubKey(Extension); BaseKey.SetValue("", KeyName); OpenMethod = Registry.ClassesRoot.CreateSubKey(KeyName); OpenMethod.SetValue("", FileDescription); OpenMethod.CreateSubKey("DefaultIcon").SetValue("", "\"" + OpenWith + "\",0"); Shell = OpenMethod.CreateSubKey("Shell"); Shell.CreateSubKey("edit").CreateSubKey("command").SetValue("", "\"" + OpenWith + "\"" + " \"%1\""); Shell.CreateSubKey("open").CreateSubKey("command").SetValue("", "\"" + OpenWith + "\"" + " \"%1\""); BaseKey.Close(); OpenMethod.Close(); Shell.Close(); CurrentUser = Registry.CurrentUser.CreateSubKey(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ucs"); CurrentUser = CurrentUser.OpenSubKey("UserChoice", RegistryKeyPermissionCheck.ReadWriteSubTree, System.Security.AccessControl.RegistryRights.FullControl); CurrentUser.SetValue("Progid", KeyName, RegistryValueKind.String); CurrentUser.Close(); }

    Read the article

  • OpenRemoteBaseKey() credentials

    - by sgibbons
    I'm attempting to use powershell to access a remote registry like so: $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMachine", $server) $key = $reg.OpenSubkey($subkeyPath) Depending on some factors that I'm not yet able to determine I either get Exception calling "OpenSubKey" with "1" argument(s): "Requested registry access is not allowed." Or System.UnauthorizedAccessException: Attempted to perform an unauthorized operation. at Microsoft.Win32.RegistryKey.Win32ErrorStatic(Int32 errorCode, String str) at Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(RegistryHive hKey, String machineName) It seems pretty clear that this is because the user I'm running the powershell script as doesn't have the appropriate credentials to access the remote registry. I'd like to be able to supply a set of credentials to use for the remote registry access, but I can find no documentation anywhere of a way to do this. I'm also not clear on exactly where to specify which users are allowed to access the registry remotely.

    Read the article

  • WIX will not add HKLM registry setting during Windows 7 install

    - by Scott Boettger
    Good Morning, I have written a WiX installer that works perfectly with Windows XP but when installing to a Windows 7 box I am running into difficulty with Registry Entries. What I need to do is add a HKLM entry as well as the registry entry for the program to show in the start menu. Here is the code i am using for both types of entry: <!-- Create the registry entries for the program --> <DirectoryRef Id="TARGETDIR"> <Component Id="RegistryEntriesInst" Guid="..."> <RegistryKey Root="HKLM" Key="Software\$(var.Manufacturer)\$(var.ProductName)" Action="createAndRemoveOnUninstall"> <RegistryValue Type="string" Name="installed" Value="true" KeyPath="yes"/> </RegistryKey> </Component> <Component Id="RegistryEntriesVer" Guid="..."> <RegistryKey Root="HKLM" Key="Software\$(var.Manufacturer)\$(var.ProductName)" Action="createAndRemoveOnUninstall"> <RegistryValue Type="string" Name="version" Value="$(var.ProductVersion)" KeyPath="yes"/> </RegistryKey> </Component> </DirectoryRef> <!-- To add shortcuts to the start menu to run and uninstall the program--> <DirectoryRef Id="ApplicationProgramsFolder"> <Component Id="ApplicationShortcut" Guid="..."> <Shortcut Id="ApplicationStartMenuShortcut" Name="$(var.ProductName)" Description="..." Target="[SERVERLOCATION]$(var.Project.TargetFileName)" WorkingDirectory="SERVERLOCATION"/> <Shortcut Id="UninstallProduct" Name="Uninstall $(var.ProductName)" Description="..." Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]"/> <RemoveFolder Id="SERVERLOCATION" On="uninstall"/> <RegistryValue Root="HKCU" Key="Software\$(var.Manufacturer)\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/> </Component> </DirectoryRef> Any help/suggestions that can be given will be appreciated. On a side note the registry permissions are the same on the XP and 7 computers. Thanks

    Read the article

  • WMS authentication plugin

    - by roul
    Hi, I'm trying to create a custom authentication plugin for WMS 2009 in C#. I managed to implement something that for some reason blocks all requests... [ComVisible(true)] [Guid("C0A0B38C-C4FE-43B5-BE9E-C100A83BBCEE")] public class AuthenticationPlugin : IWMSBasicPlugin, IWMSAuthenticationPlugin, IWMSAuthenticationContext private const string SubKey = "SOFTWARE\\Microsoft\\Windows Media\\Server\\RegisteredPlugins\\Authentication\\{C0A0B38C-C4FE-43B5-BE9E-C100A83BBCEE}"; [ComRegisterFunction] public static void RegisterFunction(Type t) { try { RegistryKey regHKLM = Registry.LocalMachine; regHKLM = regHKLM.CreateSubKey(SubKey); regHKLM.SetValue(null, "UC WMS Authentication plugin"); RegistryKey regHKCR = Registry.ClassesRoot; regHKCR = regHKCR.CreateSubKey("CLSID\\{C0A0B38C-C4FE-43B5-BE9E-C100A83BBCEE}\\Properties"); regHKCR.SetValue("Name", CustomC WMS Authentication plugin"); regHKCR.SetValue("Author", "Me"); regHKCR.SetValue("CopyRight", "Copyright 2009. All rights reserved"); regHKCR.SetValue("Description", "Enables custom WMS authentication"); } catch (Exception error) { Console.WriteLine(error.Message, "Inside RegisterFunction(). Cannot Register."); } } [ComUnregisterFunction] public static void UnRegisterFunction(Type t) { try { RegistryKey regHKLM = Registry.LocalMachine; regHKLM.DeleteSubKey(SubKey); RegistryKey regHKCR = Registry.ClassesRoot; regHKCR.DeleteSubKeyTree("CLSID\\{C0A0B38C-C4FE-43B5-BE9E-C100A83BBCEE}"); regHKCR.DeleteSubKeyTree("CSEventTest.CSEventPlugin"); } catch (Exception error) { Console.WriteLine(error.Message, "Cannot delete a subkey."); } } #region IWMSBasicPlugin Members public void InitializePlugin(IWMSContext serverContext, WMSNamedValues namedValues, IWMSClassObject classFactory) { } public void ShutdownPlugin() { } public void EnablePlugin(ref int flags, ref int heartbeatPeriod) { } public void DisablePlugin() { } public object GetCustomAdminInterface() { return null; } public void OnHeartbeat() { } #endregion #region IWMSAuthenticationPlugin Members public IWMSAuthenticationContext CreateAuthenticationContext() { return (IWMSAuthenticationContext)this; } public int GetFlags() { return Convert.ToInt32(WMS_AUTHENTICATION_FLAGS.WMS_AUTHENTICATION_ANONYMOUS, CultureInfo.InvariantCulture); } public string GetPackageName() { return "Custom WMS Authentication"; } public string GetProtocolName() { return "Basic"; } #endregion #region IWMSAuthenticationContext Members public void Authenticate(object responseBlob, IWMSContext userContext, IWMSContext presentationContext, IWMSCommandContext commandContext, IWMSAuthenticationCallback callBack, object context) { callBack.OnAuthenticateComplete(WMS_AUTHENTICATION_RESULT.WMS_AUTHENTICATION_SUCCESS, null, context); } public IWMSAuthenticationPlugin GetAuthenticationPlugin() { return (IWMSAuthenticationPlugin)this; } public string GetImpersonationAccountName() { return String.Empty; } public int GetImpersonationToken() { return 0; } public string GetLogicalUserID() { return this.GetImpersonationAccountName(); } #endregion } Can anyone spot why this is happening? Also, is there any way I could have a look at the code for the standard Anonymous Authentication plugin already installed on the server? Is it in an assembly somewhere? Thanks.

    Read the article

  • The worker processcalls OpenSubKey but returns null by accessing Remote Registry service.

    - by Cary
    My web server is deployed in IIS 6. The web server starts the Remote Registry service in the remote machine successfully by creating a process to run some remote operation commands. This first line runs successfully. But the second line returns null. #1 RegistryKey remoteRegKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, "139.24.185.27"); #2 RegistryKey targetKey = remoteRegKey.OpenSubKey(@"SOFTWARE\Wow6432Node\XXXX\XXXX\Config\Modality", true); I tried to find the reason from MSDN. It tells only one case it would return null. The case is when the subkey does not exist. If it has not enough permission, it will throw exception. But the subkey really exists. I change another machine to debug my code with Visual Studio 2008. It can run two lines successfully. If it has enough permission, it should not only can open the LocalMachine, but also can open any of its subkeys. I am quite confusing about this.

    Read the article

  • Registry in .NET: DeleteSubKeyTree says the subkey does not exists, but hey, it does!

    - by CharlesB
    Hi, Trying to delete a subkey tree: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.hdr. .hdr subkey has one subkey, no values. So I use this code: RegistryKey FileExts = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts"); RegistryKey faulty = FileExts.OpenSubKey(".hdr"); Debug.Assert (faulty != null && faulty.SubKeyCount != 0); faulty.Close(); FileExts.DeleteSubKeyTree(".hdr"); And I get the ArgumentException with message "Cannot delete a subkey tree because the subkey does not exist." WTF? I checked and asserted it did exist?

    Read the article

  • Disabling Task manager using c# in OS Hardened machine

    - by srk
    I am using the below code to disable the task manager for a kiosk application which works perfectly public void DisableTaskManager() { RegistryKey regkey; string keyValueInt = "1"; string subKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"; try { regkey = Registry.CurrentUser.CreateSubKey(subKey); regkey.SetValue("DisableTaskMgr", keyValueInt); regkey.Close(); } catch (Exception ex) { MessageBox.Show("DisableTaskManager" + ex.ToString()); } } But when i run this in OS hardened machine i get the following error, DisableTaskManagerSystem.UnauthorizedAccessException: Access to the registry key 'HKey_Current_User\Software\Mictrosoft\Windows\CurrentVersion\Policies\System' is denied. at Microsoft.win32.RegistryKey.win32Error(int32 errorcode, String str) How can i overcome this ? I need to do this for a Kiosk application.

    Read the article

  • Change a registry value in vb.net

    - by mhofer
    Hello, I have searched a lot to find a solution for my problem, but I can't find any specific solution. I need to change a value which is stored under HKEY_LOCAL_MACHINE\SOFTWARE\APP_NAME. It is not possible to use .NET's registry functions, since they have drastic restrictions. The following snippet should solve my problem: Dim regKey As RegistryKey Dim ver As Decimal regKey = My.Computer.Registry.LocalMachine.OpenSubKey("HKEY_LOCAL_MACHINE\SOFTWARE\APP_NAME", True) regKey.SetValue("IP", "192.168.10.15:18500") regKey.Close() Unfortunately, I get a NullReferenceExeption when I try to set the value. What should I do? I have imported Microsoft.Win32 and RegistryKey doesn't accept any constructor... cheers mike

    Read the article

  • Programmatically Set Proxy Address, Port, User, Password throught Windows Registry

    - by Fábio Antunes
    I'm writing a small C# application that will use Internet Explorer to interact with a couple a websites, with help from WatiN. However, it will also require from time to time to use a proxy. I've came across Programmatically Set Browser Proxy Settings in C#, but this only enables me to enter a proxy address, and I also need to enter a Proxy username and password. How can I do that? Note: It doesn't matter if a solution changes the entire system Internet settings. However, I would prefer to change only IE proxy settings (for any connection). The solution has to work with IE8 and Windows XP SP3 or higher. I'd like to have the possibility to read the Proxy settings first, so that later I can undo my changes. EDIT With the help of the Windows Registry accessible through Microsoft.Win32.RegistryKey, i was able to apply a proxy something like this: RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true); registry.SetValue("ProxyEnable", 1); registry.SetValue("ProxyServer", "127.0.0.1:8080"); But how can i specify a username and a password to login at the proxy server? I also noticed that IE doesn't refresh the Proxy details for its connections once the registry was changed how can i order IE to refresh its connection settings from the registry? Thanks

    Read the article

  • Can't read from RSOP_RegistryPolicySetting WMI class in root\RSOP namespace

    - by JCCyC
    The class is documented in http://msdn.microsoft.com/en-us/library/aa375050%28VS.85%29.aspx And from this page it seems it's not an abstract class: http://msdn.microsoft.com/en-us/library/aa375084%28VS.85%29.aspx But whenever I run the code below I get an "Invalid Class" exception in ManagementObjectSearcher.Get(). So, does this class exist or not? ManagementScope scope; ConnectionOptions options = new ConnectionOptions(); options.Username = tbUsername.Text; options.Password = tbPassword.Password; options.Authority = String.Format("ntlmdomain:{0}", tbDomain.Text); scope = new ManagementScope(String.Format("\\\\{0}\\root\\RSOP", tbHost.Text), options); scope.Connect(); ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, new ObjectQuery("SELECT * FROM RSOP_RegistryPolicySetting")); foreach (ManagementObject queryObj in searcher.Get()) { wmiResults.Text += String.Format("id={0}\n", queryObj["id"]); wmiResults.Text += String.Format("precedence={0}\n", queryObj["precedence"]); wmiResults.Text += String.Format("registryKey={0}\n", queryObj["registryKey"]); wmiResults.Text += String.Format("valueType={0}\n", queryObj["valueType"]); } In the first link above, it lists as a requirement something called a "MOF": "Rsopcls.mof". Is this something I should have but have not? How do I obtain it? Is it necessary in the querying machine or the queried machine? Or both? I do have two copies of this file: C:\Windows>dir rsop*.mof /s Volume in drive C has no label. Volume Serial Number is 245C-A6EF Directory of C:\Windows\System32\wbem 02/11/2006 05:22 100.388 rsop.mof 1 File(s) 100.388 bytes Directory of C:\Windows\winsxs\x86_microsoft-windows-grouppolicy-base-mof_31bf3856ad364e35_6.0.6001.18000_none_f2c4356a12313758 19/01/2008 07:03 100.388 rsop.mof 1 File(s) 100.388 bytes Total Files Listed: 2 File(s) 200.776 bytes 0 Dir(s) 6.625.456.128 bytes free

    Read the article

  • Creating a process in ASP.NET MVC controller

    - by GRKamath
    I have a requirement to run an application through my MVC controller. To get the installation path I used following link (I used answer provided by Fredrik Mörk). It worked and I could able to run the exe through a process. The problem occurred when I deployed this solution on IIS where it did not create the process as it was creating in local dev environment. Can anybody tell me how to create a windows process through a solution which is hosted on IIS ? private string GetPathForExe(string fileName) { private const string keyBase = @"SOFTWARE\Wow6432Node\MyApplication"; RegistryKey localMachine = Registry.LocalMachine; RegistryKey fileKey = localMachine.OpenSubKey(string.Format(@"{0}\{1}", keyBase, fileName)); object result = null; if (fileKey != null) { result = fileKey.GetValue("InstallPath"); } fileKey.Close(); return (string)result; } public void StartMyApplication() { Process[] pname = Process.GetProcessesByName("MyApplication"); if (pname.Length == 0) { string appDirectory = GetPathForExe("MyApplication"); Directory.SetCurrentDirectory(appDirectory); ProcessStartInfo procStartInfo = new ProcessStartInfo("MyApplication.exe"); procStartInfo.WindowStyle = ProcessWindowStyle.Hidden; Process proc = new Process(); proc.StartInfo = procStartInfo; proc.Start(); } }

    Read the article

1 2 3  | Next Page >