Author Posts

April 18, 2017 at 5:30 pm

I've tried a number of combinations and now I feel it may be the platform the NAS is constructed on. I know it doesn't respond to wmi calls altho it does have ldap.
I simply cannot get a wildcard search to work on our NAS.

pastebin script

This works on my home network, configured for the corp network addresses, it will not succeed.

A direct search taking out all variables is successful at work, so it's not permissions related.
I've excluded two directories with similar naming conventions I don't want searched or lack permission to.

I tried a regex but that failed in both locations ^PIC_?[0-9]{0,3}$ I chose three for future proofing but I also tried {0,2}.

Is there something wrong with the script or is it timing out or some other factor?

Thank you.

April 18, 2017 at 5:35 pm

So, it depends a lot on the NAS.

For one, I'd look at using the -Directory switch on Get-ChildItem, if you can, versus the PSIsContainer property. It'll be a bit faster.

But... where is it breaking? Is $file populating correctly? At what point in the script does it stop performing as expected?

April 18, 2017 at 6:21 pm

Yeah, right at $file

odd thing is if I do a get-childitem straight to the folder it works. when I do that I don't use get-item.
Maybe something to that.

April 18, 2017 at 6:22 pm

It's possibly the -exclude parameter.

April 19, 2017 at 1:53 pm

it's the wildcard *

get-item works no problem when called explicitly, and I've already tried gci and found it working.

So my next thought is to create an array and loop through each folder but when I set up a regex to describe the acceptable folder structure it didn't like that either and I know my regex is good, which leaves me with writing it out by hand.

I'll figure out a way to automate the array to start with PIC and stop at a failed resolve-path / test-path ( both work ).

April 20, 2017 at 3:42 pm

This is what I came up with:

subloc script

any advice on silencing the incremental add ($i++) and the test-path = true in function find-SUB?

I'm getting a list of numbers and a zero with the output.

This is all going into a graphical interface that I've already created and I'd like to make sure the output is controlled.

Thanks!