NET.EXE comando /ADD non supporta nomi di lunghezza superiore a 20 caratteri
Questo articolo fornisce una soluzione a un errore che si verifica quando si usa il NET.EXE /ADD
comando con nomi di utenti o gruppi più lunghi di 20 caratteri.
Si applica a: Windows 10 (tutte le edizioni), Windows Server 2019, Windows Server 2016, Windows Server 2012 R2
Numero KB originale: 324639
Sintomi
Quando si usa il NET.EXE
comando insieme all'opzione /ADD
e ai nomi di utenti o gruppi lunghi, viene visualizzata solo la sintassi NET. Non viene visualizzato alcun messaggio di errore.
Esempio:
C:\>NET.EXE localgroup MyRemoteUsers "REMOTE INTERACTIVE LOGON" /ADD
The syntax of this command is:
NET LOCALGROUP [groupname [/COMMENT:"text"]] [/DOMAIN]
groupname {/ADD [/COMMENT:"text"] | /DELETE} [/DOMAIN]
groupname name [...] {/ADD | /DELETE} [/DOMAIN]
La stessa azione funziona con Gestione computer gui, Utenti locali e Gruppi Microsoft Management Console (MMC).
Causa
Il comando NET.EXE non supporta nomi di lunghezza superiore a 20 caratteri per motivi di compatibilità con le versioni precedenti con LAN Manager 2.0.
Risoluzione
Se non è possibile utilizzare il metodo GUI (Graphical User Interface) ed è necessario un metodo di scripting, usare l'utilità Resource Kit di Windows 2000 Cusrmgr.exe. In alternativa, usare VBScript usando un'API (Application Programming Interface) che supporta nomi più lunghi di 20 caratteri.
Stato
Microsoft ha confermato che questo problema si verifica nei prodotti elencati nella sezione "Si applica a".
Ulteriori informazioni
Nell'esempio nella sezione "Sintomi" di questo articolo usare la sintassi Cusrmgr.exe seguente:
C:\>CUSRMGR.EXE -u "REMOTE INTERACTIVE LOGON" -alg "MyRemoteUsers"
Questo problema può verificarsi anche con le versioni localizzate in cui i gruppi predefiniti superano il limite di 20 nomi di caratteri. Ad esempio, con il nome tedesco per "Authenticated Users" (19 caratteri): "Authentifizierte Benutzer" (25 caratteri).
L'esempio VBScript seguente può essere adattato e usato come soluzione alternativa aggiuntiva. Aggiunge "Authenticated Users" a "Power Users" per la versione inglese e tedesca:
##### VBScript ADDGRP.VBS #####
On Error Resume Next
Dim oContainer
Dim oGroup
Dim oIADs
Dim oComputerInformation
Dim bolGroupSet
bolGroupSet = False
Set oComputerInformation = CreateObject("WScript.Network")
Set oContainer = GetObject("WinNT://" +
oComputerInformation.ComputerName)'get the IADsContainer object for the local computer
oContainer.Filter = Array("Group")'We only need to enumerate groups,
therefore the filter
For Each oIADs In oContainer 'for each IADs object we find there
If oIADs.Name = "Hauptbenutzer" Or oIADs.Name = "Power Users" Then
'check if it has the name "Power Users" or "Hauptbenutzer"
Set oGroup = oIADs 'If so put it into the IADsGroup object
oGroup.Add ("WinNT://S-1-5-11")'add the group "Authenticated Users"
oGroup.SetInfo 'and save the info
If Err <> 0 Then 'if error number is not 0 (Error occurred)
MsgBox Err.Number, vbCritical, "AddGroup" 'print out the error message
Else 'if everything seems to be ok
bolGroupSet = True 'set the boolean value to True so we know the group was added
End If
End If
Next
If bolGroupSet = True Then 'if bolGroupSet is False there was nothing done
MsgBox "Group added successfully", vbInformation, "AddGroup"
Else
MsgBox "No action has taken place!", vbExclamation, "AddGroup"
End If
##### script end #####
Soluzione alternativa
Per risolvere questo problema in Windows Server 2008 e versioni successive, usare il comando PowerShell Add-ADGroupMember , come descritto nell'articolo TechNet seguente:
Add-ADGroupMember
Se si usa PowerShell 5.1, usare il comando Di PowerShell Add-LocalGroupMember -Group , come descritto nell'articolo seguente:
Add-LocalGroupMember
Commenti e suggerimenti
https://aka.ms/ContentUserFeedback.
Presto disponibile: nel corso del 2024 verranno dismessi i problemi di GitHub come meccanismo di feedback per il contenuto e verranno sostituiti con un nuovo sistema di feedback. Per altre informazioni, vedere:Invia e visualizza il feedback per