Jump to content

Recommended Posts

Posted
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. ;) :D

 

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 }

  • Thanks 1
Posted (edited)
If you want something simple and elegant don't copy ancient (6+ year old) PowerShell scripts you find on the Internet. ;) :D

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 by pcstru
Posted
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.

Posted
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!

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...