Ik heb nul ervaring op het gebied van VBS compileren, maar ik heb toch een poging geprobeerd. Want wat ik wil realiseren is dat een register key:
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName] "mnmsrvc"
Door middel van een prompt gewijzigd kan worden.
Ik kwam met goochelen op deze site: http://www.experts-exchan...indows/XP/Q_23865252.html die redelijk een gelijkmatig issue had, alleen met een loop inbouwd om meerdere regiuster values aan te passen.
Dit script werd er als oplossing gegeven:
Ik heb geprobeerd om het script aan te passen om het toe te passen in mijn situatie, maar daar krijg ik meteen een error op line 5, en je raad het al hier stopt mijn kennis.
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName] "mnmsrvc"
Door middel van een prompt gewijzigd kan worden.
Ik kwam met goochelen op deze site: http://www.experts-exchan...indows/XP/Q_23865252.html die redelijk een gelijkmatig issue had, alleen met een loop inbouwd om meerdere regiuster values aan te passen.
Dit script werd er als oplossing gegeven:
VBScript:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| Const HKEY_LOCAL_MACHINE = &H80000002 Const cTitle = "Change Registry Values" strComputer = "." Set oWS = CreateObject("wscript.shell") Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ strComputer & "\root\default:StdRegProv") sKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" sValueName = "DefaultUserName" sDomain = "DefaultDomainName" sDomainValue = "MCPS" Do sValue = InputBox("Please type in the DefaultUserName registry value you want to use:", cTitle, "(Enter value)") If sValue = "" Then sRes = oWS.Popup("Sorry, you must enter the DefaultUserName reg value to continue." &_ " Do you wish to try again?", ,cTitle,vbExclamation+vbYesNo) If sRes = vbNo Then oWS.Popup "User canceled, Exiting script!", , cTitle, vbInformation WScript.Quit End If End If Loop Until sValue <> "" oReg.SetStringValue HKEY_LOCAL_MACHINE,sKeyPath,sValueName,sValue oReg.SetStringValue HKEY_LOCAL_MACHINE,sKeyPath,sDomain,sDomainValue oReg.GetStringValue HKEY_LOCAL_MACHINE,sKeyPath,sValueName,sValue2 oReg.GetStringValue HKEY_LOCAL_MACHINE,sKeyPath,sDomain,sDomainValue2 If sValue <> sValue2 Or sDomainValue <> sDomainValue2 Then oWS.Popup "There was a problem in changing the registry values," &_ " please check that you have enough rights to write to the HKLM of the registry", , cTitle, vbCritical Else oWS.Popup "Registry values were changed successfuly!", , cTitle, vbInformation End If |
Ik heb geprobeerd om het script aan te passen om het toe te passen in mijn situatie, maar daar krijg ik meteen een error op line 5, en je raad het al hier stopt mijn kennis.
VBScript:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
| Const HKEY_LOCAL_MACHINE = &H80000002 Const cTitle = "Change Registry Values" strComputer = "." Set oWS = CreateObject("wscript.shell") Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ strComputer & "\root\default:StdRegProv") sKeyPath = "SYSTEM\ControlSet001\Control\ComputerName\ComputerName" sValueName = "ComputerName" Do sValue = InputBox("Please type in the ComputerName registry value you want to use:", cTitle, "(Enter value)") If sValue = "" Then sRes = oWS.Popup("Sorry, you must enter the ComputerName reg value to continue." &_ " Do you wish to try again?", ,cTitle,vbExclamation+vbYesNo) If sRes = vbNo Then oWS.Popup "User canceled, Exiting script!", , cTitle, vbInformation WScript.Quit End If End If Loop Until sValue <> "" oReg.SetStringValue HKEY_LOCAL_MACHINE,sKeyPath,sValueName,sValue If sValue Then oWS.Popup "There was a problem in changing the registry values," &_ " please check that you have enough rights to write to the HKLM of the registry", , cTitle, vbCritical Else oWS.Popup "Registry values were changed successfuly!", , cTitle, vbInformation End If |
Bos Digitale Autoservice Onafhankelijke automotive dienstverlening; diagnose, codering, retrofit, sleutelservice, ECU en tuning. Projecten