Ciao a tutti,
sono diversi giorni che sto impazzendo con un windows services; lo scopo da raggiungere è inserire l'utente SYSTEM nel gruppo administrators se per caso è stato rimosso.
Questo è il codice che utilizzo:
Dim Utenza_da_verificare as string = "NT AUTHORITY/SYSTEM"
Dim machine As New DirectoryEntry("WinNT://" & My.Computer.Name & ",computer")
Dim group As DirectoryEntry = machine.Children.Find("Administrators", "group")
Dim isMember As Boolean = Convert.ToBoolean(group.Invoke("IsMember", Utenza_da_verificare))
If isMember = False Then
group.Invoke("Add", New Object() {Utenza_da_verificare})
End If
Con altri username funziona, mentre per l'account system non riesco a trovare il nome giusto.
Le ho provate veramenet tutte, ma invano: NT AUTHORITY/SYSTEM, NT AUTHORITY\SYSTEM, NT AUTHORITY, SYSTEM,NT AUTHORITY/SYSTEMS, ecc....
Qualche idea?
Grazie 1000 fin da ora
Bye Bye
---------------------------------------------------
Roberto Gelmini - Microsoft Certified Professional
www.robertogelmini.com
---------------------------------------------------