I wrote this script that runs well for 90% of what it does, which is the weird thing as it seems to have an issue completing another iteration of exactly where its successful.
Line 56 has a typo that reads $TIMS when it should read $TPS - not sure how to change it as I don’t have a github account.
It starts a vpn. Scans ALL drives for a specifically named folder, iterates that result into a java call.
Now the java jar functions perfectly for anything that’s caught in the C:\ drive but it seems to either hang or loop or run indefinitely for any folder not base in c:.
I can’t even kill it with sysinternals pkill or stop-process. When I try to reboot the system the whole thing hangs.
On my test machine it seems to hang on the F:\ drive. The report the java file creates makes an F__verifier.log report (two underscores because everything in C:\ is in projects, but I chalked that up to just the log generator and not the actual launching of the java jar.
The one in the case I am reviewing the drive is not local, it’s a usb external (which is often the case with these remote systems).
I have a feeling the problem I’m running into is hardware related, in-part.
Because of a couple bad reboots where the end user was required I looked into event manager and found loads of bad block messages originating from the external drive.
My main worry was that the script would stay forever on the external drive (there is only 1 project on it).
The script ran two scans simultaneously and completed many other projects until only the project on the external remained, and seemingly never went away.
The fear was that somehow the script was looping the external drive. It definitely completed and did not loop the local drive projects.
Just had one of those “process won’t die” experiences with this script. It had been running for about 12 hours and I threw everything at it. pskill, kill, stop-process, all the fun stuff.
I threw so many things at it in the end I have no idea what actually took it out.
This was all after I already stopped the task in Task Manager.
This system has a real hang-up with this script. Strange that it only effects this one thread. All the rest end with expected results.
The java call in task manager looks perfect…
Cannot determine if it’s looping or just train-wrecking.
About to deploy this on over a hundred systems but may need to postpone.
on a hunch I removed lines 55 & 57 and changed 56 to say Write Host “$($Projects[$]) $($TIMS[$])”
Now on my personal system I have a lot of drives
The result was 10 lines from C:, 3 lines for D:\ and 1 from H:
All the $Project entries are correct for all 14 results, no more or less than what was expected.
The $TIMS entry for C:\ and H:\ are correct.
D:\ is messed up. All 3 $TIMS entries are wrong. However they only swap within results of D:\
The primary issue I see is that in the other drives $projects are found in the same folder structure.
Either in the root of the drive or found within a “Projects” folder. The exception is D:\ where $Projects are found in both the root and within 1 directory below root.
So… keep in mind I’m operating blind ;). I don’t understand what “$TIMS entries are wrong” means, because I don’t know what either “right” or “wrong” is meant to look like. Can you help me understand what data you’re dealing with, and what outcome you’re looking for?
so the verifier needs to find the project which we can do without problem using $projects.
The folder name of $projects is what I’m trying to find in $TIMS but perhaps I’m over complicating things.
The end result I need is C:\Projects\12345 12345 I need those two 12345’s to match exactly.
I was trying to reference the array but it’s not working out.
Maybe a more reliable and simpler way is to extract everything after the last slash and join it to the end…
Yeah, I’m still distinctly unclear on what the data DOES look like and what the data SHOULD look like, so I’m going to be utterly useless to you. Keep in mind, I’m not in your environment and I can’t run your code.
These results are easy to find. $projects does a good job of that. The number of results can vary (both drive letter, number of drives returned and directories, whose name’s are random).
When I pipe the results into the java file (seems to work) whatever that last folder name is I need to tag it to the end.
So C:\1234A must follow with 1234A and nothing else or else it won’t work. C:\1234A 1234A
H:\Projects\66566 must follow with 66566 so result will be H:\Projects\66566 66566