Imports System.IO Imports System.Security.AccessControl Imports System.Security.Principal Module Module1 Sub Main() Dim folderPath As String = "xxxxxxxxxx" ' フォルダパスを指定 Dim account As String = "BUILTIN\Users" Dim directorySecurity As DirectorySecurity = Directory.GetAccessControl(folderPath) Dim authorizationRules As AuthorizationRuleCollection = directorySecurity.GetAccessRules(True, True, GetType(NTAccount)) Dim usersGroupHasAccess As Boolean = False For Each rule As FileSystemAccessRule In authorizationRules Console.WriteLine($"{rule.IdentityReference}:{rule.FileSystemRights}") If rule.IdentityReference.Value.Equals(account, StringComparison.CurrentCultureIgnoreCase) Then If rule.FileSystemRights.HasFlag(FileSystemRights.Read) Then usersGroupHasAccess = True Exit For End If End If Next If usersGroupHasAccess Then Console.WriteLine("フォルダに 'Users' グループのアクセス権があります。") Else Console.WriteLine("フォルダに 'Users' グループのアクセス権がありません。") End If End Sub End Module