次の方法で共有


NET.EXE /ADD コマンドは、20 文字を超える名前をサポートしていません

この記事では、20 文字を超えるユーザー名またはグループ名で NET.EXE /ADD コマンドを使用したときに発生するエラーの解決策について説明します。

元の KB 番号: 324639

現象

NET.EXE コマンドを /ADD スイッチと長いユーザーまたはグループ名と共に使用すると、NET 構文のみが再表示されます。 エラー メッセージは表示されません。

例:

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]

同じ操作 GUI コンピューター管理、ローカル ユーザー、およびグループ Microsoft 管理コンソール (MMC) で動作します。

原因

NET.EXE コマンドは、LAN Manager 2.0 との下位互換性のために 20 文字を超える名前をサポートしていません。

解決方法

グラフィカル ユーザー インターフェイス (GUI) メソッドを使用できず、スクリプト方法が必要な場合は、Windows 2000 Resource Kit ユーティリティ Cusrmgr.exeを使用します。 または、20 文字を超える名前をサポートするアプリケーション プログラミング インターフェイス (API) を使用して、VBScript を使用します。

状態

マイクロソフトでは、この問題をこの資料の対象製品として記載されているマイクロソフト製品の問題として認識しています。

詳細

この記事の「現象」セクションの例では、次のCusrmgr.exe構文を使用します。

C:\>CUSRMGR.EXE -u "REMOTE INTERACTIVE LOGON" -alg "MyRemoteUsers"

この問題は、組み込みグループが 20 文字の名前制限を超えるローカライズされたバージョンでも発生する可能性があります。 たとえば、"Authenticated Users" (19 文字) のドイツ語名を使用します。"Authentifizierte Benutzer" (25 文字)。

次のサンプル VBScript は、追加の回避策として適合して使用できます。 英語とドイツ語のバージョンでは、"Power Users" に "Authenticated Users" が追加されます。

##### 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 #####

回避策

Windows Server 2008 以降でこの問題を回避するには、次の TechNet 記事で説明されているように、 Add-ADGroupMember PowerShell コマンドを使用します。
Add-ADGroupMember

PowerShell 5.1 を使用している場合は、次の記事で説明するように、 Add-LocalGroupMember -Group PowerShell コマンドを使用します。
Add-LocalGroupMember