Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted

I'm popping this in Scripts as the problem is being caused by a login script that I have working perfectly on three other setups but for some reason it wants nothing to do with me on this setup.

 

The only difference is that this server is an R2 version of Win2k3 and there seem to be some significant differences relating to the folder redirection and I'm guessing a security change somewhere too.

 

Anyway the script is attached... if someone could give it a look over and see if they can spot why it's getting this error:

 

Invalid root in registry key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal"

 

What I'm trying to do is setup a number of shares and get one of them to be the "My Documents" by default but it just doesn't want to stick.

 

This is with a client that has WinXPSP2.

 

Interestingly enough it seems that looking at the resultant policy wizard results.. the computer is NOT losing the My Documents redirect I tried at one point too... Deleting the initial policy seems to make lilttle difference.

 

Can anyone help this is driving me round the flippin bend!!

staff_fldr_map_login.vbs

Posted

Just a suggestion shouldn't there be a backslash in there after the drive name

 

path1 = "H:[color=Red]\[/color]"
path2 = path1 & "My Pictures"

 

you could possibly just map it using the UNC path from your other variable instead as another option:

 

path1 = strUserFolder

  • Thanks 1
Posted (edited)

Looks like this error message gets thrown up when the reg key does not exist.

 

I am writing a script to verify that a registry key exists. The script works fine and gives me the information I need if the key exists, but if the key does not exists the script errors out on me. The error I get is INVALID ROOT IN REGISTRY KEY.
Verify registry key exists

 

I usually just use folder redirection in a GPO for this as it is a pretty robust method.

Edited by SYNACK
Posted

It's actually looking like it's a permissions error... or at least that's what happens when I try to run the script manually...

 

When the script runs as part of a login routine it doesn't even manage to map everything properly... I think that may be related to something else though... one sec.

Posted

Ah... think it may be a permissions issue with something else..

 

If I try to set the target manually I get "The location you requested is not allowed as a target."

Posted
That would make sence, to the script it would look like simply be an unaccessible location and so would throw the error. You should be able to reset the permissions on that key to allow testing, just need to right click on the key in regedit and click permissions.
Posted

Tied it down further... this is only affecting users that have a profile that pre-existed and had to be reset with perms. That means I must have bollixed up something in the permissions there...

 

Hmm... It's probably an old gpo setting in there or something equally as sodding annoying... :censored:

Posted

Ahah!... Got you, you :censored:!!

 

Turns out I f***ed up the permissions resets I did for the folders...

 

Small note for anyone else who finds themselves in this position.

- Remove inheritance

- Take ownership as administrator

- Add the profile user and give them full control

- THEN make them the owner for the folder..

 

DON'T... make them the owner and then give them full control... that somehow messes stuff up.

 

Right.. time to resolve the rest of these accounts... :)

 

 

Thanks all for your input.. this was one really throwing me out to lunch. :doh:

Posted
Why do you not use group policy?

 

Z

 

Missed this earlier... because I have a system for doing this stuff (which has worked to date).,.. plus I've tried using group policy and it still borks, falls over and kicks the baby out with the bath water.

 

This is weird... trying to figure out why one account works when the others don't is just nuts.

Posted

:censored: it...

 

Whatever was causing the issue I just reached my limit.. I've taken ownership of the whole lot, shifted it to an OLD folder and then let the system recreate the accounts when they next login... If they need anything from the old profiles I can always copy/paste stuff in to their my docs folders... thankfully nothing massively important being held in there but damn if it wasn't a head scratcher.. :doh::mad:

Posted
Sorry just to double check the client is SP2 not 3?

 

Yeah... it's definitely SP2... it could be that a "Fix" got in there though... either way, as I said, I took the easy way out.

Posted
I very much doubt that permissions on the folder you are redirecting to would prevent the script from writing to the registry.

 

If it's just the 'Shell Folders' key that is erroring out, you could try skipping it altogether. The Technet article here (Windows Confidential: The Sad Story of the Shell Folders Key) states that the 'Shell Folders' key is only there for compatibility reasons for a few bad apps.

 

In the hard light of the next day I think I ended up smooshing the permissions on the old accounts as tiredness and frustration overtook. Having nowhere quiet or undisturbed made things worse and had I realised I was in meltdown mode I'd have probably quit and gone home to avoid damage.

 

Thanks for the info on the shell folders, the script doesn't just set that but as I said, I have four schools I look after so changing the approach on one confuses later on if you're not careful so I prefer consistency... (Yeah, I know, I put R2 on here.. :doh:)

 

Anyway, whatever it was I think I just got overzealous and with only a small number of accounts I just recreated... One day I'll probably try an academic exercise to see if I can get it working on a VM machine but for now we're back and running.

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