windows-server-2012-r2 – 在启用了配额的故障转移群集中添加共
我有文件服务集群,其中一个文件服务器资源托管?50,000个用户主目录.主目录具有通过 FSRM分配的配额模板. 尝试使用故障转移群集管理器的“添加文件共享”向导添加新共享时,它首先在所有已定义的文件服务器群集资源上检索所有共享文件夹上的所有配额.在这种环境下需要大约10分钟. 我怎么可能 >加快配额枚举的过程 ? 我终于解决了这个问题,提出了完全使用GUI进行文件共享创建的要求.相反,我记录了使用New-SmbShare作为共享创建过程.以这种方式添加共享会绕过GUI向导正在执行的所有预配置检查,包括配额枚举.New-SmbShare -Name <ShareName> -ScopeName "<CAPName>" -Path "<LocalDirectoryToBeShared>" -FullAccess "Everyone" -Description "<Comment>"
我的缩短版本看起来像这样: #Using Win32 API NetShareAdd via p/invoke to be able to specify the scope in SHARE_INFO_503 $signature = @" using System; using System.Runtime.InteropServices; using System.Collections; public class NativeMethods { [DllImport("Netapi32.dll")] public static extern uint NetShareAdd([MarshalAs(UnmanagedType.LPWStr)] string strServer,Int32 dwLevel,ref SHARE_INFO_503 buf,out uint parm_err); [StructLayoutAttribute(LayoutKind.Sequential)] struct SECURITY_DESCRIPTOR { public byte revision; public byte size; public short control; public IntPtr owner; public IntPtr group; public IntPtr sacl; public IntPtr dacl; } public enum SHARE_TYPE : uint { STYPE_DISKTREE = 0,STYPE_PRINTQ = 1,STYPE_DEVICE = 2,STYPE_IPC = 3,STYPE_SPECIAL = 0x80000000 }; [StructLayout(LayoutKind.Sequential,CharSet = CharSet.Unicode)] public struct SHARE_INFO_503 { public string shi503_netname; [MarshalAs(UnmanagedType.U4)] public SHARE_TYPE shi503_type; public string shi503_remark; [MarshalAs(UnmanagedType.U4)] public int shi503_permissions; [MarshalAs(UnmanagedType.U4)] public int shi503_max_uses; [MarshalAs(UnmanagedType.U4)] public int shi503_current_uses; public string shi503_path; public string shi503_passwd; public string shi503_servername; [MarshalAs(UnmanagedType.U4)] public int shi503_reserved; public IntPtr shi503_security_descriptor; } public static uint ShareFolder(string servername,string sharename,string path,string remark) { SHARE_INFO_503 shInfo = new SHARE_INFO_503(); shInfo.shi503_netname = sharename; shInfo.shi503_type = SHARE_TYPE.STYPE_DISKTREE; shInfo.shi503_remark = remark; shInfo.shi503_permissions = 0; shInfo.shi503_max_uses = -1; shInfo.shi503_current_uses = 0; shInfo.shi503_path = path; shInfo.shi503_passwd = null; shInfo.shi503_servername = servername; shInfo.shi503_reserved = 0; shInfo.shi503_security_descriptor = IntPtr.Zero; uint nRetValue = 0; uint param_err = 0; nRetValue = NetShareAdd(servername,503,ref shInfo,out param_err); //Console.WriteLine("Sharing " + path + " on " + servername + " as " + sharename + " returned " + nRetValue + " (" + param_err+ ")"); return nRetValue; } } "@ #Import the FailoverClusters PowerShell module if it is not already imported Import-Module FailoverClusters #Add the function type that will be used to share the folder in the defined scope Add-Type -TypeDefinition $signature 用法很简单: [NativeMethods]::ShareFolder("<CAPname>","<ShareName>","<LocalDirectoryToBeShared>","<Comment>") ShareFolder函数在成功执行后返回0并立即结束,即使启用了配额.在托管CAP /文件服务器资源的其中一个集群节点上运行.您可能必须在之后修复共享ACL,因为默认共享创建ACL只是Everyone:Read并且无法使用此方法指定. (编辑:呼伦贝尔站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 5个用于开发工作的 Linux 发行版
- windows – 并行端口阻塞
- 不喜欢Windows 11系统上弹出的系统通知,可以这样禁用它
- Firefox 70 将引入“非活跃 CSS”,快速排查 CSS 属性
- windows-server-2008 – 远程桌面100%通过浏览器?
- windows-terminal-services – 通过WAN运行终端服务器(RDS)
- 科技的资本“寒冬”,程序员如何学习Linux开发实现增值呢?
- windows-server-2008-r2 – 我需要打开哪些防火墙端口才能使
- 如何在CentOS或RHEL系统上检查可用的安全更新?
- Windows – %变量%和!变量之间的差异!在批处理文件中
- 32位Windows Server地址gt; 4GB RAM – 如何?
- 在Server 2012R2上安装KB2919355之后的Inaccessi
- Windows下Emacs中的zsh Shell
- active-directory – 如何登录不信任自己的域控制
- windows-server-2008 – 如何为Windows 2008安装
- haskell – 仅从全屏浮动窗口中移除边框(XMonad配
- 如何用九条命令在一分钟内检查Linux服务器性能?
- windows – 如何从主机访问虚拟机上的Web服务器
- 你的Windows电脑真的有必要硬盘分区吗?
- Windows 10 Update2019(1903)后如何修复无声音