/ADD コマンド NET.EXE 20 文字を超える名前はサポートされていません
この記事では、20 文字を超えるユーザー名またはグループ名でコマンドを NET.EXE /ADD
使用するときに発生するエラーの解決策について説明します。
適用対象: Windows 10 - すべてのエディション、Windows Server 2019、Windows Server 2016、Windows Server 2012 R2
元の KB 番号: 324639
現象
スイッチ名と長いユーザー名またはグループ名と共にコマンドを/ADD
使用NET.EXE
すると、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
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示