un truc du genre... je cherche mais je ne trouve rien, si quelqu'un pouvais m'aiguiller...
#domaine + admin du domaine
$username = "domaine\admin.domaine"
#instantiation d'un credential
$cred = new-object -typename System.Management.Automation.PSCredential `
-argumentlist $username, $password
#Supprime le domaine
#Remove-Computer -credential domaine\admin.domaine -MotdePass -verbose;
Remove-Computer -credential $cred
#reintegration au domaine
#Add-Computer -DomainName domaine -Credential domaine\admin.domaine;
Add-Computer -DomainName domaine -Credential $cred
$username = "domaine\admin.domaine"
#instantiation d'un credential
$cred = new-object -typename System.Management.Automation.PSCredential `
-argumentlist $username, $password
#Supprime le domaine
#Remove-Computer -credential domaine\admin.domaine -MotdePass -verbose;
Remove-Computer -credential $cred
#reintegration au domaine
#Add-Computer -DomainName domaine -Credential domaine\admin.domaine;
Add-Computer -DomainName domaine -Credential $cred

