j'ai pu créer mon compte local qui appartient à Utilisateurs
Sur ma VM, 2000 Pro, si je tape la ligne de commande :
net localgroup Administrateurs MyAdminAccount /add
ca marche.
sur ma machine en Vista Pro (qui appartient à un domaine), je me tape l'erreur 1789 concernant une relation d'approbation avec le domaine.
Dans le 1er cas, le nom du groupe (ie Administrateurs) est codé en dur ce qui est mal vu que sur les versions anglaises, ce sera Administrators.
il semblerait qu'il faille passer par le SID.
Mais est ce la bonne voie :
http://www.pinvoke.net/default.aspx/advapi32.LookupAccountSid
SecurityIdentifier secid = new SecurityIdentifier("S-1-5-32-544");
byte[] binaryForm = new byte[256];
secid.GetBinaryForm(binaryForm, 0);
ensuite il faut chopper son nom pour l'injecteur à la commande NET.exe je dirais ?
thx,
++
vincent
----------------------------
C++ forever
C# amateur
A voir également:
Accueil nouveautés "inscrire un site" contact admin
using System;
using System.Diagnostics;
using System.IO;
using System.ComponentModel;
namespace CreateWindowsAccount
{
internal sealed class NetCommandUtility
{
// These are the Win32 error code for file not found or access denied.
const int ERROR_FILE_NOT_FOUND = 2;
const int ERROR_ACCESS_DENIED = 5;