Jump to content

Recommended Posts

Posted

i have a setup where due to macs the users areas are shared as \\server\username$ rather than the simpler \\server\users$\group\name

now these are all setup with caching set to disabled and im looking at setting up staff with roaming and synced documents. I could manually go hrough and turn syncing on all folders but there has to be a better way. I have a script tht will create shares with aching enabled but if the folder is already shared it just errors out (again i could possibly write a script to unshare the folders first then run this but if i can do it as 1 command id be happier

 

current code is

for /f %%u in (users.txt) do net share %%u$="D:\test\%%u" /grant:everyone,full /cache:Documents

 

does anyone know a way i can just use that or simiular to just change the caching options?

Posted
You could do a search and replace on the registry entries for the shares. Entries for all of the shares are kept in HKLM\System\CurrentControlSet\services\Lanmanserver\shares. You could export that and then do a search and replace on the CSCFlags value which governs caching. Then import your modified registry file and reboot. Be very careful that this doesn't affect the value on any shares that you do not want to change - and in fact, just be careful in general. Make sure that you keep your original registry export in case something goes awry and you need to put things back how they were.
Posted

Powershell can do this

 

$server="my_server_name"
$share="my_share_name"
([wmiclass]"\\$server\root\cimv2:Win32_Process").create("cmd /c net share $share /cache:programs")

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...