Arthur Posted October 15, 2016 Posted October 15, 2016 I'm obviously becoming too programmed by PowerShell and neglecting sometimes simpler, more elegant solutions. If you want something simple and elegant don't copy ancient (6+ year old) PowerShell scripts you find on the Internet. The following is the PowerShell equivalent of @snagrat's one-liner. Get-ChildItem -Directory | ForEach { New-SmbShare -Name ('{0}{1}' -f $_.BaseName,'$') -Path $_.FullName -FullAccess Everyone -CachingMode None } and if you ever need to bulk remove the shares... Get-ChildItem -Directory | ForEach { Get-SmbShare -Name ('{0}{1}' -f $_.BaseName,'$') | Remove-SmbShare -Confirm:$false } 1
pcstru Posted October 17, 2016 Posted October 17, 2016 (edited) If you want something simple and elegant don't copy ancient (6+ year old) PowerShell scripts you find on the Internet. heh.To be fair, I put my AD scripts together a few years ago (~4) and sometimes it's just the quickest thing to work that gets the job. Was the Smbshare stuff actually available back then? Edited October 17, 2016 by pcstru
Arthur Posted October 17, 2016 Posted October 17, 2016 Was the Smbshare stuff actually available back then? It was actually. heh. To be fair, I put my AD scripts together a few years ago (~4) and sometimes it's just the quickest thing to work that gets the job. That's fair enough. Personally I sometimes revisit older scripts as I usually find there are better/easier ways to achieving the same task.
pcstru Posted October 17, 2016 Posted October 17, 2016 Personally I sometimes revisit older scripts as I usually find there are better/easier ways to achieving the same task. Trying to do exactly that I find it is not available on my local client machine. I admit we are not in any sense living on the bleeding edge. I prefer others to have the fun of that!
Arthur Posted October 17, 2016 Posted October 17, 2016 I find it is not available on my local client machine. Windows 7?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now