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

fixed top navbar covering buttons
Issues with Intellisense and class library
C#: Generate Separate Variable for Each Value in Array
selectedvalue property in cascadingdropdown
change textbox's Text in another class without pass form as variable? [closed]
Namespace could not be found
error in c# when use the loop
How to convert array elements in native iOS (Objective-C to C#)
How to add new items in Gridview through POPUP WINDOW
how to avoid open page already exist on Navigation stack? [duplicate]
Create Entity Framework model based on an existing database in ASP.NET Core
Rotate image in a button
WPF: Updating Database (TwoWay) doesn´t work with Linq-Query
c# How to avoid child form to inherit his mdi parent WindowState property?
Using type FileInfo in WPF XAML
Password encryption in PHP equivalent to C#

Categories

HOME
ckan
ssms
stanford-nlp
customization
wifi
latex
dynamic
jquery-plugins
azure-resource-manager
ubuntu-14.04
app-store
bitbucket
ms-application-insights
ms-access-2010
jshell
markdown
rename
jcodemodel
websharper
sha1
alert
caldav
coccinelle
fibonacci
multipart
mattermost
fastboot
pumping-lemma
functional-dependencies
waterfall
chartist.js
deployment-descriptor
edsdk
lines
scene7
oracle-nosql
ilog
anypoint-studio
const
scalamock
origami
byobu
linkurious
socketcluster
quartz
amazon-rds-aurora
chrome-custom-tabs
spring-data-commons
vertex
htop
programming-pearls
sharing
cedar-bdd
mac-app-store
visual-web-developer
jspx
altova
jira-agile
normalisation
recurring
angularfire
avaudiorecorder
transaction-isolation
nugetgallery
dday
markerspiderfier
github-for-mac
skscene
newlib
self-join
personality-insights
identifying
roslyn-code-analysis
sparkcore
numerical-recipes
touch-typing
static-files
os.walk
go-gin
famous-engine
cocos2d-x-2.x
agent-based-modeling
im4java
xps
connections
internet-radio
cvi
windows-phone-store
sygic
objectdatasource
oc4j
qgraphicsscene
proj4
magicsuggest
pymel
rbm
junit-rule
mail-gem
wpml
php-gettext
systrace
optimistic-concurrency
mvcmailer
stl-algorithm
discussion-board
session-hijacking
soapexception
xhtmlrenderer
html5-animation
table-valued-parameters
database-agnostic
pitch-shifting
xslt-grouping
newspeak
data-formats
time-management
manuals
disk-based
weak-typing
ironpython-studio

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