0

VS2008で展開プロジェクトを実行しています。インストールフローの最後に、会社のドメインからアクセスできるローカルマシン上のEveryoneに対するフルコントロールのアクセス許可を持つ共有フォルダーを作成する必要があります。共有フォルダの作成に成功しましたが、全員が読み取りアクセス権を持っています。これを行う方法についての助けをいただければ幸いです。

ありがとう、バレリウ

4

1 に答える 1

0

を使用して共有フォルダーManagementClassを作成していると思います。

あなたの Access フィールドを設定すると、ManagementBaseObject全員が完全に制御できるようになります。

ManagementClass mc = new ManagementClass("win32_share");
ManagementBaseObject inParams = mc.GetMethodParameters("Create");
inParams["Description"] = "Shared Folder";
// ... whathever ...
inParams["Access"] = null; // <-- should give full control access to everyone

上記が機能しない場合は、次のように smt を使用して明示的にセキュリティ レベルを設定してみてください。

    public static void AddDirectorySecurity(string FileName, string Account, FileSystemRights Rights, AccessControlType ControlType)
    {
        DirectoryInfo dInfo = new DirectoryInfo(FileName);

        DirectorySecurity dSecurity = dInfo.GetAccessControl();

        // Add the FileSystemAccessRule to the security settings.  
        dSecurity.AddAccessRule(new FileSystemAccessRule(Account,
                                                         Rights,
                                                         ControlType));
        // Set the new access settings. 
        dInfo.SetAccessControl(dSecurity);
    } 

上記のいずれも役に立たない場合は、コードを投稿することをお勧めします。

于 2009-11-23T15:09:10.617 に答える