473,657 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Checking for a registry value...

How can I lookup registry values?

I'd like to check for the existence of this folder in the registry:
HKLM\Software\A cmeCompany\MWIA pplications\Aut oLogonForShared Workstations

so that I can use a login prompt for only these machines.

Has anyone ever done this?

Sep 29 '06 #1
3 1497

It's possible to work with the Windows registry using the
Microsoft.Win32 .Registry class, and other related classes from the same
namespace.

http://msdn2.microsoft.com/en-us/lib....registry.aspx
jonefer wrote:
How can I lookup registry values?

I'd like to check for the existence of this folder in the registry:
HKLM\Software\A cmeCompany\MWIA pplications\Aut oLogonForShared Workstations

so that I can use a login prompt for only these machines.

Has anyone ever done this?
Sep 29 '06 #2

Here is some old old vb.net code I dug up.
Notice the imports and the bad hungarian notation.


Imports Microsoft.Win32

Public Class RegReader
Public Shared Function ReadRegValue(By Val strKeyName As String) As
String

Dim regVersion As RegistryKey
Dim keyValue As String

keyValue = "SOFTWARE\\MySu bThingLikeMicro soft"
regVersion = Registry.LocalM achine.OpenSubK ey(keyValue, False)
Dim strRegistryValu e As String
strRegistryValu e = string.Empty
If (Not regVersion Is Nothing) Then
strRegistryValu e = regVersion.GetV alue(strKeyName , "")
regVersion.Clos e()
End If

return strRegistryValu e

End Function

End Class


"jonefer" <jo*****@discus sions.microsoft .comwrote in message
news:7B******** *************** ***********@mic rosoft.com...
How can I lookup registry values?

I'd like to check for the existence of this folder in the registry:
HKLM\Software\A cmeCompany\MWIA pplications\Aut oLogonForShared Workstations

so that I can use a login prompt for only these machines.

Has anyone ever done this?

Sep 29 '06 #3
This is very helpful - will this bring up any 'Security' errors if the
machine that my application runs this code on doesn't have admin rights?

"sloan" wrote:
>
Here is some old old vb.net code I dug up.
Notice the imports and the bad hungarian notation.


Imports Microsoft.Win32

Public Class RegReader
Public Shared Function ReadRegValue(By Val strKeyName As String) As
String

Dim regVersion As RegistryKey
Dim keyValue As String

keyValue = "SOFTWARE\\MySu bThingLikeMicro soft"
regVersion = Registry.LocalM achine.OpenSubK ey(keyValue, False)
Dim strRegistryValu e As String
strRegistryValu e = string.Empty
If (Not regVersion Is Nothing) Then
strRegistryValu e = regVersion.GetV alue(strKeyName , "")
regVersion.Clos e()
End If

return strRegistryValu e

End Function

End Class


"jonefer" <jo*****@discus sions.microsoft .comwrote in message
news:7B******** *************** ***********@mic rosoft.com...
How can I lookup registry values?

I'd like to check for the existence of this folder in the registry:
HKLM\Software\A cmeCompany\MWIA pplications\Aut oLogonForShared Workstations

so that I can use a login prompt for only these machines.

Has anyone ever done this?


Sep 30 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5134
by: GujuBoy | last post by:
i want to check to see if a certain program is installed on my windows box using python. how can i do that...(ie, i want to see if "word" is installed) please help
1
16322
by: rdavis7408 | last post by:
I have a database that has a form that opens a report using date parameters. I have been using it for six months and last week I began to get the following Error Message: "File sharing lock count exceeded. Increase MaxLocksPerFile registry entry." I checked in the Tools - Options - Advance. I have the database shared with no locks selected and record level locking selected.
1
2574
by: Adnan Selimovic | last post by:
Hi folks! I have Framework 1.0 installed and I would like to point to registry from my Web.config file: <connectionString> <add key="password" value="registry:HKLM\Software\Foo,password" /> <add key="userID" value="registry:HKLM\Software\Foo,userID" /> <add key="initialCatalog" value="registry:HKLM\Software\Foo,initialCatalog" /> <add key="dataSource" value="registry:HKLM\Software\Foo,dataSource" /> <add key="integratedSecurity"
5
2429
by: Jeff | last post by:
Hi - I'm creating an installation program that will install a VB.NET program and an instance of MSDE on an unknown desktop (commercial application). The install will include the MSDE redistributable files (and it will launch the MSDE Setup.exe to install MSDE). I've read that "Except on Win 98 and Millennium, file and print sharing must be active"
4
9098
by: Kevin L | last post by:
I store some application settings in the registry under HKEY_LOCAL_MACHINE\Software\MyApplication I want to allow full access to this key and subkeys. Currently, I manually change the permissions on the keys. How can I accomplish this through code?
0
273
by: gsb58 | last post by:
Hi! I have a little problem with the registry function. The function is supposed to check the registry as the main form is activated. If there is a key it should not write to the registry, as it does. Can anybody see what I'm doing wrong? Private Sub WriteToRegistry() Dim regKey As RegistryKey = Nothing
2
5569
by: Ben | last post by:
I think I might have found a bug in Visual Studio. The following code should work and doesn't: My.Computer.Registry.LocalMachine.CreateSubKey("Software\Dravet") My.Computer.Registry.LocalMachine.SetValue("HKEY_LOCAL_MACHINE\Software\Dravet", "loglevel", "1") My.Computer.Registry.LocalMachine.GetValue("loglevel") This code does work: My.Computer.Registry.LocalMachine.CreateSubKey("Software\Dravet")
2
1401
by: Nick 'The Database Guy' | last post by:
Hi All, I have writen a value to the registry. What I want to know is, is there a way that I can check that value? Thanks in advance. Nick
2
2101
by: causesdrowsiness | last post by:
Hi everyone. Sorry if this is the wrong group for this question, but since it is .NET and VB, I thought someone may be able to help me here or point me to the right group for this. I am working on an application which needs to check if a certain VALUE exists in a registry subkey. Is there an easy way to do this? So far, my googles have come up empty on this, though they DO have a plethora of information on checking if a KEY exists.
0
8312
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8504
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8606
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.