Author Posts

July 2, 2014 at 11:08 am

Hello,

I was wondering if someone could help me with a particular issue I'm having, can't seem to work this out.

So i have a share on a SAN, lets say the share at the top level is '\\Share01' and that share contains lots of projects for example the structure might be like this

Top Level: \\Share01
Child Level: \\Share01\Project_One
Child Level: \\Share01\Project_Two
Child Level: \\Share01\Project_Three

Now, keep in mind i cannot do the following with these shares

1. I cannot map to the share \\Share01, therefore you can't go to My Computer map it is X drive and try and browse it – This is not permitted
2. The only thing you can map to is directly to \\Share01\Project_One or \\Share01\Project_Two but NOT \\Share01 directly

What i want to do is pretty simple, check the permissions for each of the Project folders. In order to do this i would imagine its something like

(sudo code)
for each share in shares
grab the permissions

simple.

The problem is how do i send in this wild card for the projects? So in my mind it would be something like

(sudo code)
shares are \\share01\project_* (* being the wildcard)
for each share in shares
get permissions

im struggling to understand how to do this. Any ideas how to go abouts this.

This should be pretty simple.. but i can't seem to cycle around the wildcard, it will just ask for the path..

Sorry if anything confusing there, let me know if anything don't make sense, cheers!

July 2, 2014 at 11:17 am

How about something like this?

Get-ChildItem \\Share01 -Include Project* -Folder

That will let you iterate over the Project folders.

July 2, 2014 at 11:25 am

Hello,

Good suggestion however that won't work the error that comes back with

get-childItem \\Share -Include Project* is:

Get-ChildItem: Cannot process argument because the value of the argument "path" is not valid. Change the value of the path and run again.

-Folder also does not exist.

Cheers

July 2, 2014 at 11:28 am

There is no parent folder that you can iterate over like \\SHARE01\SHARE?

How would you see these Project folders via the GUI? Just going to \\SHARE01 in Windows Explorer?

July 2, 2014 at 11:33 am

There is no parent folder thats the issue... Its directly to \\SHARE01 and you can go to that on the GUI

however you cannot map to it and i can't get to directly on command line either..

So its a matter of.. go to '\\SHARE01\Project_ [whatever is first here anything starting with A, lets say – grab that share and bring back permissions then go to next share]

There is a lot of folders in here... the alternative way is for me to export that list into a CSV file and then cycle through them.. but i can't seem to get to it on command line so thats out of the question also.

im stumped lol

July 2, 2014 at 11:47 am

Try to see if your SAN vendor has a Powershell module. If you can get one, look for a cmdlet that you can use to enumerate the shares. Once you've got that, you're golden.

July 2, 2014 at 11:51 am

Thanks – explaining the problem popped another idea into my head.

just realised we create AD groups for each share which contains the project name so i've just exported that

I just tested it now and cycled through them with a test-path and it returns true! so i think this might just work!

Although it would be nice how to know how we could tackle this if AD wasn't involved. It really shouldn't be that hard... but it is! lol

July 2, 2014 at 10:15 pm

What about:

Get-childitem "\\share01\project_*"

July 3, 2014 at 2:20 am

that doesn't do anything im afraid...

July 3, 2014 at 6:20 am

If it's a NAS with a CIF server, you may be able to access it with an admin share (e.g. \\server\h$\...). Another possibility is DFS is you have available and some kind of logical structure ("\\domain\projects\project1" = target "server\project1") and WMI (Win32_DFSTarget) can enumerate the target path. I've tried a couple iterations trying to connect to even a Windows-based UNC and nothing is enumerated, but Windows I can use Win32_Share to enumerate and get a UNC path.

July 7, 2014 at 2:54 am

Since it's a non-Windows storage device, I doubt there are any easy ways of showing a list of shares.

The easiest solution would be to create a new share on the parent folder and giving only a service account read access to that.

Alternatively you can browse through manuals and documentation to see if your device supports any kind of WMI/CIM remote management. Or perhaps contacting the vendor would be faster.

Now if it was a Windows server hosting the shares then things would be a lot easier.

July 7, 2014 at 5:31 am

Have you tried "net view \\share01" ? It's an old way of displaying shared folders, printers, etc on an SMB endpoint. You'd have to do some string parsing to pull out the share names, but it might work.

July 7, 2014 at 6:21 am

Dave Wyatt! what a genius! That works perfectly – String manipulation is no problem i can see all the shares!

Thanks very much thats very helpful!