c#


How to change the registry value of remote system using C#


Hai every one
I am developing an windows application in which i have to block the removable storage devices such as pendrives.I found that its possible by changing the registry value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor,start value to 4.But the problem is I have to block it on remote systems too.Can any one suggest me how to change the value of registry of remote system using c# with a code or sites where i can i find the code for this.
The .net way is to use Microsoft.Win32.RegistryKey.OpenRemoteBaseKey.
An alternative would be to use WMI. There are lots of examples on Google for reading values; replacing GetStringValue with SetStringValue (or SetDWORDValue, etc.) should do what you want.
You probably want to take a look at the Remote Registry Service and make an RPC call.
MSDN description: http://msdn.microsoft.com/en-us/library/aa940121(WinEmbedded.5).aspx
MSDN example using RegistryKey.OpenRemoteBaseKey: http://msdn.microsoft.com/en-us/library/8zha3xws.aspx
You need to have Remote Registry service running on remote machine. Then you can use WMI to connect the registry. Here is a code sample script from this site:
Dim strComputer
Dim strUserName
Dim strPassword
Dim objLocator
Dim objService
Dim objRegistry
strComputer = "somesys"
strUserName = "somename"
strPassword = "somepw"
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objService = objLocator.ConnectServer( strComputer, _
"Root\Default", strUserName, strPassword )
objService.Security_.impersonationlevel = 3
Set objRegistry = objService.Get( "StdRegProv" )
'Do something here like retrieving or setting values.
Set objRegistry = Nothing
Set objLocator = Nothing
Set objService = Nothing
you can get many valuable results by googling for "using WMI to modify remote registry"

Related Links

reflection with stacktrace / stackframe to get both methods name and parameters
Distance between two numbers in looping sequence [closed]
Back button disabling links in content placeholder?
XAML ControlTemplate from string
Entity Framework Fluent API Mapping
Check for Square Brackets in Datatable.Select
Unable to read from stream in C#
Ranorex Passing Array as Parameter
Deleting null items from an ObservableCollection
How to convert decimal(integer) to binary, working with the binary and then convert it back to decimal in C#
Ensuring Thread-Safety On Static Methods In C#
Async method never returns [duplicate]
C# and ReSharper: Checking an object's type
How to pass more parametrers than used in an oracle query in ODP.NET without getting exception?
How to: HTTP GET and POST request with parameters in Win 8 modern app using C# and XAML
Word Interop Catch Document Edit Event

Categories

HOME
max
indexing
openacc
spss
msbi
aggregation-framework
uml-designer
psexec
zabbix
rethinkdb
segmentation-fault
angularjs-ng-repeat
normals
olap
adroitlogic
watson-dialog
appsettings
luis
web-parts
javaagents
uipath
datastax-enterprise
datanucleus
typeclass
angular-schema-form
restangular
undo
slim-lang
directions
favorites
sampling
gstreamer-1.0
blueimp
cowboy
rbac
delphi-xe
android-graphview
jquery-ui-slider
superclass
django-cors-headers
ack
jenkins-2
opos
evaluation
beanshell
appcmd
e4
bipartite
google-scholar
addressbook
directinput
gevent
mac-app-store
scikit-image
jigsaw
gdi
system-integration
salesforce-service-cloud
google-finance-api
identifying
first-order-logic
syncano
tinymce-plugins
autopep8
mri
static-files
fedena
unityvs
visual-c#-express-2010
isl
reactjs-native
smartxls
nodeunit
vbaccelerator
friendly-id
cab
ironworker
static-class
exi
wordbreaker
qmainwindow
architectural-patterns
zepto
tasklist
mail-gem
sup
nsscrollview
unordered-set
rjs
recess
zipstream
nbehave
lgpl
p4.net
uccapi
helios

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App