+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
Scripts Thread, My Documents script not working on R2 in Coding and Web Development; I'm popping this in Scripts as the problem is being caused by a login script that I have working perfectly ...
  1. #1
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118

    My Documents script not working on R2

    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\Curr entVersion\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!!
    Attached Files Attached Files

  2. #2

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,095
    Thank Post
    857
    Thanked 2,680 Times in 2,273 Posts
    Blog Entries
    9
    Rep Power
    769
    Just a suggestion shouldn't there be a backslash in there after the drive name

    Code:
    path1 = "H:\"
    path2 = path1 & "My Pictures"
    you could possibly just map it using the UNC path from your other variable instead as another option:

    path1 = strUserFolder

  3. Thanks to SYNACK from:

    contink (11th June 2008)

  4. #3

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,095
    Thank Post
    857
    Thanked 2,680 Times in 2,273 Posts
    Blog Entries
    9
    Rep Power
    769
    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.
    Last edited by SYNACK; 10th June 2008 at 04:16 PM.

  5. #4
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118
    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.

  6. #5
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118
    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."

  7. #6

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,850
    Thank Post
    877
    Thanked 1,681 Times in 1,460 Posts
    Blog Entries
    12
    Rep Power
    445
    Why do you not use group policy?

    Z

  8. #7

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,095
    Thank Post
    857
    Thanked 2,680 Times in 2,273 Posts
    Blog Entries
    9
    Rep Power
    769
    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.

  9. #8
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118
    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...

  10. #9
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118
    Ahah!... Got you, you !!

    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.

  11. #10
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118
    Well I thought I'd got it... Now WTF is going on??!!

  12. #11
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118
    Quote Originally Posted by FN-Greatermanchester View Post
    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.

  13. #12

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,850
    Thank Post
    877
    Thanked 1,681 Times in 1,460 Posts
    Blog Entries
    12
    Rep Power
    445
    Sorry just to double check the client is SP2 not 3?

  14. #13
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118
    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..

  15. #14
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118
    Quote Originally Posted by FN-Greatermanchester View Post
    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.

  16. #15
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,632
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    34
    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.

  17. Thanks to ajbritton from:

    contink (11th June 2008)

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 19
    Last Post: 18th April 2008, 07:49 AM
  2. Replies: 14
    Last Post: 27th March 2008, 04:57 PM
  3. Replies: 21
    Last Post: 29th December 2007, 10:53 PM
  4. Script to Create My Documents Subject Folders
    By SwedishChef in forum Scripts
    Replies: 15
    Last Post: 5th July 2006, 08:14 AM
  5. Redirecting "My Documents" Not Working!
    By secman in forum Windows
    Replies: 7
    Last Post: 14th February 2006, 11:56 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •