Bonjour à tous,

J'utilise un script « vbs » afin de mettre en place un « autologon » sur un PC en Windows7.
Se script se lance pendant une installation WDS-MDT.
Pas de souci, tout cela fonctionne bien sauf que dés que je l'installe dans une autre langue le script ne fonctionne par car le compte utilisé est "Administrateur" et non "Administrator" (Ex : US).
J'aimerais que mon script puisse détecter la version installée et en conséquence, mettre le bon compte.
Mes connaissance son rudimentaire et je n'arrive à rien, pouvez-vous m'éclaircir sur le chemin à prendre.
Merci.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
38
39
40
41
42
Option Explicit
On Error Resume Next
Err.Clear
 
dim StdOut, objReg, strKeyPath, strStringValueName, strSetStringValue, strEntryName, strValue, strLoginPath
dim Wshshell, ArgObj, sArgCount, x
 
Set WshShell = WScript.CreateObject("WScript.Shell")
 
const HKEY_LOCAL_MACHINE = &H80000002
Set StdOut = WScript.StdOut
 
strSetStringValue = "c:\winnt\system32\wscript.exe c:\someWSHFile.vbs"
strStringValueName = "Description of the process"
 
Set ArgObj = WScript.Arguments
sArgCount = ArgObj.Count
 
For x = 0 to sArgCount - 1
    Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ 
    ArgObj(x) & "\root\default:StdRegProv")
 
    strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\ANewRegistryKey"
    strLoginPath = "Software\Microsoft\Windows NT\CurrentVersion\Winlogon"
    objReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
    objReg.SetStringValue HKEY_LOCAL_MACHINE, strLoginPath, "AutoAdminLogon", "1"
    objReg.SetStringValue HKEY_LOCAL_MACHINE, strLoginPath, "DefaultUserName", "Administrateur"
    objReg.SetStringValue HKEY_LOCAL_MACHINE, strLoginPath, "DefaultPassword", ".........."
    objReg.SetStringValue HKEY_LOCAL_MACHINE, strLoginPath, "AutoLogonCount", "1"
    objReg.SetStringValue HKEY_LOCAL_MACHINE, strLoginPath, "DefaultDomainName", ArgObj(x)
    objReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strStringValueName, strSetStringValue
    set objReg = Nothing
Next
 
set wshshell = nothing
set argobj = nothing
 
Sub ErrorHandler(byVal errornum, byVal errorDesc)
    theDesc = "Error Number: " & errornum & " Error Description: " & errorDesc
    WshShell.LogEvent 1, theDesc
    err.clear
End Sub