Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 3 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
I am trying to change only the path for LanmanServer Shares in the registry. I am using the below but I am finding that is is not working. Am thinking that it is because path is a Deserialized.System.String[] and I am just creating a string. So it is not being read right. I am using the code below. The funny thing is if I manually add it like this
Why would you want to do this in the registry. There are CmdLets that can create or change shares using th ecorrect system APIs.
The entries are arrays of strings and you are trying to use a simple sting to create them. You need to use a MULTISZ to assign this kind of registry value.
I want to keep the security settings for the share. I jsut need to change the path of the share. Also want to do this across remote servers. I dont want to create I want to modify. So am assuming I can use Set-SmbShare with invoke-command??
It will work without a reboot just have to restart server service. Also I am not trying to make a new share but just adjust a share path. It looks like New-SMbshare makes a new share. Is not possible to just change the path of the share?
Why? Just remove and recreate the share. You are rewriting everything for an exisiting share wh9ich doesn't just change the share. What youy are trying to do cannot be done with the registry directly.
You can also use "Set-SmbShare" to alter a share. To change the path you must remove and recreate the share.
You can use Get-SmbShare to copy and alter the share path then apply it to the new share.
Yes, restarting the server service will do the same thing as a system restart. It will also be as destructive as a system restart.
This topic is 3 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.