EDN Admin
Well-known member
Is there a way to set the "Offline Settings" for a share to none when creating a share using Win32_Share? I am able to create shares without a problem using the code below, but I am unable to set the "Offline Settings" to "Files of programs from the share will not be available offline". I was able to successfully do it using the command line option of "/cache:none" on a net share command, but how do I do the same thing when creating the share using WMI? The code I use to create the share is below:<br/><br/>
View the full article
Code:
mc = new ManagementClass(wmiPath, "Win32_Share", null);
inParams = mc.GetMethodParameters("Create");
inParams["Description"] = username;
inParams["Name"] = username + "$";
inParams["Path"] = fullLocalPath;
inParams["Type"] = 0x0; //Disk Drive
inParams["MaximumAllowed"] = null;
inParams["Access"] = GetShareAccess(wmiPath);
outParams = mc.InvokeMethod("Create", inParams, null);
View the full article