OVH Cloud OVH Cloud

reintegre un domaine

2 réponses
Avatar
Luc
Bonjour j'ai du changer mon serveur 2003 AD et j'ai installer windows
serveur 2003 sur la nouvelle machine, j'ai recrée les comptes comme ils
etaient.
Meme nom de domaine, meme partages et tout.
Quand j'integre les postes au domaines ils se créent un nouveau profil.
Je voudrais savoir la methode pour reintegre mes postes au domaine sans
devoir refaire les profils.
Mes postes son en XP pro


Merci

2 réponses

Avatar
Jonathan Bismuth
Bonjour Luc,
Ce comportement est assez normal. Lorsque tu crée un utilisateur, même sur
un domaine qui port le même nom, un nouvel Sid est créé pour lui.
Les profils de tes utilisateurs sont fixés quand à eux sur leur ancien Sid,
et je te passe les valeurs du registre...

Je peux te proposer :
de suivre la manipulation suivante :
http://support.microsoft.com/kb/314045/fr

ou d'utiliser mon script de migration de profil (en AutoIT) dont tu trouvera
le code si-dessous, utilise le depuis un compte admin du domaine, et exécute
le depuis un dossier ou tu aura récupéré :
- reg.exe (en natif sur XP)
- subinacl.exe :
http://www.microsoft.com/downloads/details.aspx?FamilyIdèBA3E56-D8FE-4A91-93CF-ED6985E3927B&displaylang=en
-user2sid.exe : http://packetstormsecurity.org/NT/docs/sid.zip
psexec.exe : http://www.sysinternals.com/Utilities/PsExec.html

;### Début du code ###
#include <Array.au3>
#include <GUIConstants.au3>

$dom = @LogonDomain

Opt("ExpandEnvStrings", 1)

$FCheck = FileExists ("c:tmp-migration")

if $FCheck= 1 Then
$void = ""
Else
DirCreate ("c:tmp-migration")
EndIf



$SubACL = FileInstall ("subinacl.exe", "c:tmp-migrationsubinacl.exe", 1)
$Reg = FileInstall ("reg.exe", "c:tmp-migrationreg.exe", 1)
$SID = FileInstall ("user2sid.exe", "c:tmp-migrationuser2sid.exe", 1)
$PS = FileInstall("psexec.exe", "c:tmp-migrationpsexec.exe",1)

$nbr = $CmdLine[0]

call ("Choice")


func Choice()
Select
case $nbr >= 2
call ("Cmmd")
case $nbr = 1 and $CmdLine[1] == "/?"
call ("Help")
exit
case $nbr = 0
msgbox (0, "Erreur de syntaxe", "Une erreur de syntaxe a eu lieu,
utilisez le commutateur /? pour afficher l'aide")
exit
EndSelect
EndFunc

func Cmmd()
; modifier le chemin avec le bon $DPath
if $CmdLine[0] = 3 Then
if $CmdLine[3] = 1 then
$DPath = "%Windir%profiles"
endif
Else
$DPath = "%SystemDrive%Documents and Settings"
endif

$profil = $CmdLine[1]
$userC1 = $CmdLine[2]
$UserC = $userC1
$Pass = "123"

if FileExists ("c:tmp-migration") =1 Then
$void = ""
Else
DirCreate ("c:tmp-migration")
EndIf

$Log = FileOpen ("c:tmp-migrationlogTrans.txt", 1)
$Write = FileWrite ($Log, "Lancement du permissionnement I" & @CRLF)
FileClose ($Log)

$DIR = RunWait (@ComSpec & " /C " & "c:tmp-migrationsubinacl.exe
/subdirectories """& $DPath &""& $profil &""" /grant="& $dom &""& $userC1
&"=F /setowner="& $dom &""& $userC1 &"")


$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "lancement TMP user2sid" & @CRLF)
FileClose ($Log)

$FSid = FileOpen ("c:tmp-migrationsid.txt", 2)
FileClose ($FSid)
$ChSID = RunWait(@ComSpec & " /C " & "c:tmp-migrationuser2sid.exe "& $dom
&""& $userC1 &" | find ""S-"" > c:tmp-migrationsid.txt")
sleep(10000)


$File = FileOpen("c:tmp-migrationsid.txt", 0)
$Line = FileReadLine ($File)

FileClose ($File)

$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "lancement PSexec" & @CRLF)
FileClose ($Log)

$ChSID = RunWait(@ComSpec & " /C " & "c:tmp-migrationpsexec.exe
%computername% -u "& $dom &""& $userC1 &" -p "& $pass &" -e exit")


sleep(10000)
$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "PSexec lancé, environnement créé" & @CRLF)
FileClose ($Log)

;### on re le user2sid ###

$ChSID = RunWait(@ComSpec & " /C " & "c:tmp-migrationuser2sid.exe "& $dom
&""& $userC1 &" | find ""S-"" > c:tmp-migrationsid.txt")
sleep(10000)

if $ChSID = 0 Then
$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "fin user2sid" & @CRLF)
FileClose ($Log)
Else
$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "erreur de Sid, l'utilisateur n'existe pas dans
le domaine" & @CRLF)
FileClose ($Log)
exit(0)
EndIf

$File = FileOpen("c:tmp-migrationsid.txt", 0)
$Line = FileReadLine ($File)

FileClose ($File)
; FileDelete ("c:tmp-migrationsid.txt")

$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "Le Sid ciblé est "& $Line &"" & @CRLF)
FileClose ($Log)

;### fin tampon ###

$RSubKey = Regread ("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows
NTCurrentVersionProfileList"&$Line, "ProfileImagePath")
$oldProf = $RSubKey

sleep(2000)

$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "profil temporaire : "& $oldProf &"" & @CRLF)
FileClose ($Log)

$RM = RegWrite ("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows
NTCurrentVersionProfileList"&$Line,
"ProfileImagePath","REG_EXPAND_SZ","%SystemDrive%Documents and Settings"&
$profil)

$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "chemin de profil modifié, lancement de l'isolaton
de la source" & @CRLF)
FileClose ($Log)


$Log = FileOpen ("c:tmp-migrationlogTrans.txt", 1)
$Write = FileWrite ($Log, "permissionnement I terminé, chargement du
registre" & @CRLF)
FileClose ($Log)

$regL = RunWait (@ComSpec & " /C " & "c:tmp-migrationreg load HKLM"&
$userC1 &" """& $DPath &""& $profil &"ntuser.dat""")

$Log = FileOpen ("c:tmp-migrationlogTrans.txt", 1)
$Write = FileWrite ($Log, "registre chargé, permissionnement des clés et
valeurs" & @CRLF)
FileClose ($Log)

$Sub = RunWait (@ComSpec & " /C " & "c:tmp-migrationsubinacl.exe /keyreg
127.0.0.1HKEY_LOCAL_MACHINE"& $userC1 &" /grant="& $dom &""& $userC1
&"=F /setowner="& $dom &""& $userC1 &"")

$SubK = RunWait (@ComSpec & " /C " & "c:tmp-migrationsubinacl.exe /keyreg
127.0.0.1HKEY_LOCAL_MACHINE"& $userC1 &"* /grant="& $dom &""& $userC1
&"=F /setowner="& $dom &""& $userC1 &"")

$SubKeyReg = RunWait (@ComSpec & " /C " & "c:tmp-migrationsubinacl.exe
/subkeyreg 127.0.0.1HKEY_LOCAL_MACHINE"& $userC1 &" /grant="& $dom
&""& $userC1 &"=F /setowner="& $dom &""& $userC1 &"")

$Log = FileOpen ("c:tmp-migrationlogTrans.txt", 1)
$Write = FileWrite ($Log, "permissionnement terminé, déchargement du
registre" & @CRLF)
FileClose ($Log)

$regU = RunWait (@ComSpec & " /C " & "c:tmp-migrationreg unload HKLM"&
$userC1 &"")

$Log = FileOpen ("c:tmp-migrationlogTrans.txt", 1)
$Write = FileWrite ($Log, "déchargement terminé, demmarage du dernier
permissionnement sur subdir" & @CRLF)
FileClose ($Log)

$SubDir = RunWait (@ComSpec & " /C " & "c:tmp-migrationsubinacl.exe
/subdirectories """& $DPath &""& $profil &"""* /grant="& $dom &""& $userC1
&"=F /setowner="& $dom &""& $userC1 &"")

$Log = FileOpen ("c:tmp-migrationlogTrans.txt", 1)
$Write = FileWrite ($Log, "fin du permissionnement, renommage des fichiers
de contact" & @CRLF)
FileClose ($Log)

;## renommage du fichier de contacts ###

$RenWab = RunWait (@ComSpec & " /C " & "ren """& $DPath &""& $profil
&"Application DataMicrosoftAddress Book"& $profil &".wab"" "& $userC1
&".wab")

if FileExists (""& $DPath &""& $userC &"Application DataMicrosoftAddress
Book"& $profil &".wa~") Then
$RenWab2 = RunWait (@ComSpec & " /C " & "ren """& $DPath &""& $profil
&"Application DataMicrosoftAddress Book"& $profil &".wa~"" "& $userC1
&".wa~")
EndIf

$Log = FileOpen ("c:tmp-migrationlogTrans.txt", 1)
$Write = FileWrite ($Log, "renommage effectué, Fin de l'opération" & @CRLF)

EndFunc


func Help()
msgbox (0, "Syntaxe","Arguments Obligatoires"& @LF &""& @LF &"- Argument 1
: nom dossier profil à migrer (préfixé automatiquement). Exemple :
user1.machine1 "& @LF &"- Argument 2 : nom de l'utilisateur à mapper"& @LF
&"- Argument 3 : mettre à 1 si l' OS est un NT 4.0" &@LF)
EndFunc
;### Fin code ###

Attention, il te faudra spécifier le temps de l'utilisation, un mot de passe
prédéfini pour l'utilisateur que tu spécifie à la ligne : $Pass = "123"

Syntaxe : W2K2 <espace> chemin du profil [sans c:documents and settings]
<espace> nom_utilisateur_nouveau_domaine

Cordialement,

--
Jonathan BISMUTH
NET2S Group
MVP Windows Server - Directory Services
MCSE 2000/ADSI-AutoIT Scripter
Transcript (ID: 691839, code: MCSE2000)
www.portail-mcse.net
pour me contacter http://cerbermail.com/?oAsXWZnZF1


"Luc" a écrit dans le message de news:

Bonjour j'ai du changer mon serveur 2003 AD et j'ai installer windows
serveur 2003 sur la nouvelle machine, j'ai recrée les comptes comme ils
etaient.
Meme nom de domaine, meme partages et tout.
Quand j'integre les postes au domaines ils se créent un nouveau profil.
Je voudrais savoir la methode pour reintegre mes postes au domaine sans
devoir refaire les profils.
Mes postes son en XP pro


Merci



Avatar
Luc
Merci


"Jonathan Bismuth" a écrit
dans le message de news:
Bonjour Luc,
Ce comportement est assez normal. Lorsque tu crée un utilisateur, même sur
un domaine qui port le même nom, un nouvel Sid est créé pour lui.
Les profils de tes utilisateurs sont fixés quand à eux sur leur ancien
Sid, et je te passe les valeurs du registre...

Je peux te proposer :
de suivre la manipulation suivante :
http://support.microsoft.com/kb/314045/fr

ou d'utiliser mon script de migration de profil (en AutoIT) dont tu
trouvera le code si-dessous, utilise le depuis un compte admin du domaine,
et exécute le depuis un dossier ou tu aura récupéré :
- reg.exe (en natif sur XP)
- subinacl.exe :
http://www.microsoft.com/downloads/details.aspx?FamilyIdèBA3E56-D8FE-4A91-93CF-ED6985E3927B&displaylang=en
-user2sid.exe : http://packetstormsecurity.org/NT/docs/sid.zip
psexec.exe : http://www.sysinternals.com/Utilities/PsExec.html

;### Début du code ###
#include <Array.au3>
#include <GUIConstants.au3>

$dom = @LogonDomain

Opt("ExpandEnvStrings", 1)

$FCheck = FileExists ("c:tmp-migration")

if $FCheck= 1 Then
$void = ""
Else
DirCreate ("c:tmp-migration")
EndIf



$SubACL = FileInstall ("subinacl.exe", "c:tmp-migrationsubinacl.exe", 1)
$Reg = FileInstall ("reg.exe", "c:tmp-migrationreg.exe", 1)
$SID = FileInstall ("user2sid.exe", "c:tmp-migrationuser2sid.exe", 1)
$PS = FileInstall("psexec.exe", "c:tmp-migrationpsexec.exe",1)

$nbr = $CmdLine[0]

call ("Choice")


func Choice()
Select
case $nbr >= 2
call ("Cmmd")
case $nbr = 1 and $CmdLine[1] == "/?"
call ("Help")
exit
case $nbr = 0
msgbox (0, "Erreur de syntaxe", "Une erreur de syntaxe a eu lieu,
utilisez le commutateur /? pour afficher l'aide")
exit
EndSelect
EndFunc

func Cmmd()
; modifier le chemin avec le bon $DPath
if $CmdLine[0] = 3 Then
if $CmdLine[3] = 1 then
$DPath = "%Windir%profiles"
endif
Else
$DPath = "%SystemDrive%Documents and Settings"
endif

$profil = $CmdLine[1]
$userC1 = $CmdLine[2]
$UserC = $userC1
$Pass = "123"

if FileExists ("c:tmp-migration") =1 Then
$void = ""
Else
DirCreate ("c:tmp-migration")
EndIf

$Log = FileOpen ("c:tmp-migrationlogTrans.txt", 1)
$Write = FileWrite ($Log, "Lancement du permissionnement I" & @CRLF)
FileClose ($Log)

$DIR = RunWait (@ComSpec & " /C " & "c:tmp-migrationsubinacl.exe
/subdirectories """& $DPath &""& $profil &""" /grant="& $dom &""& $userC1
&"=F /setowner="& $dom &""& $userC1 &"")


$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "lancement TMP user2sid" & @CRLF)
FileClose ($Log)

$FSid = FileOpen ("c:tmp-migrationsid.txt", 2)
FileClose ($FSid)
$ChSID = RunWait(@ComSpec & " /C " & "c:tmp-migrationuser2sid.exe "&
$dom &""& $userC1 &" | find ""S-"" > c:tmp-migrationsid.txt")
sleep(10000)


$File = FileOpen("c:tmp-migrationsid.txt", 0)
$Line = FileReadLine ($File)

FileClose ($File)

$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "lancement PSexec" & @CRLF)
FileClose ($Log)

$ChSID = RunWait(@ComSpec & " /C " & "c:tmp-migrationpsexec.exe
%computername% -u "& $dom &""& $userC1 &" -p "& $pass &" -e exit")


sleep(10000)
$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "PSexec lancé, environnement créé" & @CRLF)
FileClose ($Log)

;### on re le user2sid ###

$ChSID = RunWait(@ComSpec & " /C " & "c:tmp-migrationuser2sid.exe "&
$dom &""& $userC1 &" | find ""S-"" > c:tmp-migrationsid.txt")
sleep(10000)

if $ChSID = 0 Then
$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "fin user2sid" & @CRLF)
FileClose ($Log)
Else
$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "erreur de Sid, l'utilisateur n'existe pas dans
le domaine" & @CRLF)
FileClose ($Log)
exit(0)
EndIf

$File = FileOpen("c:tmp-migrationsid.txt", 0)
$Line = FileReadLine ($File)

FileClose ($File)
; FileDelete ("c:tmp-migrationsid.txt")

$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "Le Sid ciblé est "& $Line &"" & @CRLF)
FileClose ($Log)

;### fin tampon ###

$RSubKey = Regread ("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows
NTCurrentVersionProfileList"&$Line, "ProfileImagePath")
$oldProf = $RSubKey

sleep(2000)

$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "profil temporaire : "& $oldProf &"" & @CRLF)
FileClose ($Log)

$RM = RegWrite ("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows
NTCurrentVersionProfileList"&$Line,
"ProfileImagePath","REG_EXPAND_SZ","%SystemDrive%Documents and
Settings"& $profil)

$Log = FileOpen ("c:tmp-migrationlogCopy.txt", 1)
$Write = FileWrite ($Log, "chemin de profil modifié, lancement de
l'isolaton de la source" & @CRLF)
FileClose ($Log)


$Log = FileOpen ("c:tmp-migrationlogTrans.txt", 1)
$Write = FileWrite ($Log, "permissionnement I terminé, chargement du
registre" & @CRLF)
FileClose ($Log)

$regL = RunWait (@ComSpec & " /C " & "c:tmp-migrationreg load HKLM"&
$userC1 &" """& $DPath &""& $profil &"ntuser.dat""")

$Log = FileOpen ("c:tmp-migrationlogTrans.txt", 1)
$Write = FileWrite ($Log, "registre chargé, permissionnement des clés et
valeurs" & @CRLF)
FileClose ($Log)

$Sub = RunWait (@ComSpec & " /C " & "c:tmp-migrationsubinacl.exe /keyreg
127.0.0.1HKEY_LOCAL_MACHINE"& $userC1 &" /grant="& $dom &""& $userC1
&"=F /setowner="& $dom &""& $userC1 &"")

$SubK = RunWait (@ComSpec & " /C " & "c:tmp-migrationsubinacl.exe
/keyreg 127.0.0.1HKEY_LOCAL_MACHINE"& $userC1 &"* /grant="& $dom
&""& $userC1 &"=F /setowner="& $dom &""& $userC1 &"")

$SubKeyReg = RunWait (@ComSpec & " /C " & "c:tmp-migrationsubinacl.exe
/subkeyreg 127.0.0.1HKEY_LOCAL_MACHINE"& $userC1 &" /grant="& $dom
&""& $userC1 &"=F /setowner="& $dom &""& $userC1 &"")

$Log = FileOpen ("c:tmp-migrationlogTrans.txt", 1)
$Write = FileWrite ($Log, "permissionnement terminé, déchargement du
registre" & @CRLF)
FileClose ($Log)

$regU = RunWait (@ComSpec & " /C " & "c:tmp-migrationreg unload HKLM"&
$userC1 &"")

$Log = FileOpen ("c:tmp-migrationlogTrans.txt", 1)
$Write = FileWrite ($Log, "déchargement terminé, demmarage du dernier
permissionnement sur subdir" & @CRLF)
FileClose ($Log)

$SubDir = RunWait (@ComSpec & " /C " & "c:tmp-migrationsubinacl.exe
/subdirectories """& $DPath &""& $profil &"""* /grant="& $dom &""&
$userC1 &"=F /setowner="& $dom &""& $userC1 &"")

$Log = FileOpen ("c:tmp-migrationlogTrans.txt", 1)
$Write = FileWrite ($Log, "fin du permissionnement, renommage des fichiers
de contact" & @CRLF)
FileClose ($Log)

;## renommage du fichier de contacts ###

$RenWab = RunWait (@ComSpec & " /C " & "ren """& $DPath &""& $profil
&"Application DataMicrosoftAddress Book"& $profil &".wab"" "& $userC1
&".wab")

if FileExists (""& $DPath &""& $userC &"Application
DataMicrosoftAddress Book"& $profil &".wa~") Then
$RenWab2 = RunWait (@ComSpec & " /C " & "ren """& $DPath &""& $profil
&"Application DataMicrosoftAddress Book"& $profil &".wa~"" "& $userC1
&".wa~")
EndIf

$Log = FileOpen ("c:tmp-migrationlogTrans.txt", 1)
$Write = FileWrite ($Log, "renommage effectué, Fin de l'opération" &
@CRLF)

EndFunc


func Help()
msgbox (0, "Syntaxe","Arguments Obligatoires"& @LF &""& @LF &"- Argument 1
: nom dossier profil à migrer (préfixé automatiquement). Exemple :
user1.machine1 "& @LF &"- Argument 2 : nom de l'utilisateur à mapper"& @LF
&"- Argument 3 : mettre à 1 si l' OS est un NT 4.0" &@LF)
EndFunc
;### Fin code ###

Attention, il te faudra spécifier le temps de l'utilisation, un mot de
passe prédéfini pour l'utilisateur que tu spécifie à la ligne : $Pass =
"123"

Syntaxe : W2K2 <espace> chemin du profil [sans c:documents and settings]
<espace> nom_utilisateur_nouveau_domaine

Cordialement,

--
Jonathan BISMUTH
NET2S Group
MVP Windows Server - Directory Services
MCSE 2000/ADSI-AutoIT Scripter
Transcript (ID: 691839, code: MCSE2000)
www.portail-mcse.net
pour me contacter http://cerbermail.com/?oAsXWZnZF1


"Luc" a écrit dans le message de news:

Bonjour j'ai du changer mon serveur 2003 AD et j'ai installer windows
serveur 2003 sur la nouvelle machine, j'ai recrée les comptes comme ils
etaient.
Meme nom de domaine, meme partages et tout.
Quand j'integre les postes au domaines ils se créent un nouveau profil.
Je voudrais savoir la methode pour reintegre mes postes au domaine sans
devoir refaire les profils.
Mes postes son en XP pro


Merci