|
-
Feb 27th, 2008, 01:52 PM
#1
Thread Starter
Lively Member
Network registry editor
I use a small vbs program to connect to another computer on our network and disable the smart card force option so we (techs) can log in manually. I didn't write this program but I was wondering if anybody could tell me what the specific calls are doing.
Code:
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = InputBox("Enter the NetBIOS Name or IP address of the computer you wish to disable Smart Card Logon:")
If strComputer = "" Then
MsgBox "Nothing was entered in the inputbox" & vbCrLf & "Or you pressed the Cancel Button"
Else:
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\windows\currentversion\policies\system"
strValueName = "ScForceOption"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
End If
wscript.Echo strComputer & " is NOT forced to use Smart Card Logon!"
-
Feb 27th, 2008, 02:37 PM
#2
Re: Network registry editor
Thread moved from CodeBank forum (which is not for asking questions)
-
Feb 27th, 2008, 03:59 PM
#3
Re: Network registry editor
looks straightforward, creates a registry object (oreg), defines the key, keypath and new value, then sets the new value
you should be setting back to the old value after finishing your task
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Feb 28th, 2008, 08:51 AM
#4
Thread Starter
Lively Member
Re: Network registry editor
I got that much. I have never seen this:
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
What is this doing?
-
Feb 28th, 2008, 03:34 PM
#5
Re: Network registry editor
stdout is just an output method of the windows scripting host to log to
oreg is a created registry objectby wimdowsmanagement (WMI) to the computer in strcomputer
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Feb 28th, 2008, 04:27 PM
#6
Thread Starter
Lively Member
Re: Network registry editor
-
Feb 28th, 2008, 10:42 PM
#7
Thread Starter
Lively Member
Re: Network registry editor
Since I haven't been here too many times, how do I mark this as resolved?
-
Feb 29th, 2008, 02:17 AM
#8
Re: Network registry editor
put the green check on the first post, by editing, or use thread tools > mark thread resolved
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|