hi all,
I thought I would give this back and see if anyone could improve on it. I
was working with the remote registry class. This code opens the
ScreenSaverIsSecure registry setting and changes it to not require a
password prompt anymore.
One change that would be helpful is to somehow figure out how to include an
IP address where the server name is called. I suspect it is a syntax I am
missing. This morning I was running it from within teh network from other
machines so I could get away with it.
Imports System.Management
Imports System
Imports Microsoft.VisualBasic
Imports System.IO
Imports System.Security.Permissions
Imports Microsoft.Win32
Dim options As ConnectionOptions
options = New ConnectionOptions()
options.Impersonation = ImpersonationLevel.Impersonate
options.Username = "username"
options.Password = "password"
Dim scope As ManagementScope
scope = New ManagementScope("\\servername\root\cimv2", options)
scope.Options.EnablePrivileges = True
scope.Connect()
If scope.IsConnected = True Then
MsgBox("CONNECTED")
End If
Try
Dim environmentKey As RegistryKey
environmentKey = RegistryKey.OpenRemoteBaseKey( _
RegistryHive.CurrentUser,
"SERVERNAME").OpenSubKey("Control Panel\Desktop", True)
For Each valueName As String In
environmentKey.GetValueNames()
If valueName.ToString = "ScreenSaverIsSecure" Then
environmentKey.SetValue(valueName, "1")
Exit For
End If
Next
Catch ex As Exception
MsgBox(ex.ToString)
End Try