+ Post New Thread
Results 1 to 7 of 7
Scripts Thread, Windows 7 Roaming Profile Permissions in Coding and Web Development; There comes a time where roaming profiles need to be backed up, however, Windows 7 and Server 2008R2 does not ...
  1. #1

    Join Date
    Mar 2012
    Location
    Birmingham
    Posts
    21
    Thank Post
    2
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Windows 7 Roaming Profile Permissions

    There comes a time where roaming profiles need to be backed up, however, Windows 7 and Server 2008R2 does not allow you to access the roaming profile folder unless the user has specifically given access.

    Here is a quick logon script I wrote to deal with this issue.

    Code:
    'This Script Sets the Permissions on Windows 7 Roaming Profiles so that we in ICTS can back them up
    'It runs in user context 
    'If something goes wrong....Seek Louis, he may know how to fix it. 
    'Another thing.... you need to use ObjNetwork.Username to get the username 
    
    On Error Resume Next
    
    Set objNetwork = wscript.CreateObject("wscript.network")							'Allows the Script to Access Username
    Set Command = Wscript.CreateObject("Wscript.Shell")  								'Allows the Script Access to the shell (CMD)
    SetPerms = "icacls.exe \\atuin\louis\test\icaclcs_test /grant administrators:(F) /T"  				'File Path which Administrator needs permissions to should be Example: \\Servername\Profiles$\" & ObjNetwork.Username & "_profile.v2"
    Dim objFSO 
    Set objFSO = CreateObject("Scripting.FileSystemObject")								'Allows the script to create a file or folder
    strPermsFldr = "\\atuin\louis\" & ObjNetwork.Username & "_profile.v2\appdata\Roaming\.PermsChk\"		'Where the folder will be stored to check permissions. Should be Example: \\Servername\Profiles$\" & ObjNetwork.Username & "_profile.v2\appdata\Roaming\.PermsChk\"
    
    
    If objFSO.FolderExists(strPermsFldr) Then
    
    '	MsgBox "The folder exists! The Journey Ends Here"										'Debugging Line, this can be commented out.
    
    Else
    
    '	MsgBox objNetwork.Username										'Debugging Line, this can be commented out.
    '	MsgBox "The folder does not exist! Please wait a moment whilst it is created"				'Debugging Line, this can be commented out.
    	objFSO.CreateFolder strPermsFldr
    '	MsgBox "Permissions Will now be set, this may take a while"						'Debugging Line, this can be commented out.
    	Command.Run (SetPerms)
    '	Msgbox "Permissions Have Now Been Set"									'Debugging Line, this can be commented out.
    	
    End If
    
    'Wscript.Echo "Permissions Successfully Set!"									'Debugging Line, this can be commented out.
    This script should be saved as a VBS and the file paths should be set to match your network environment.

    Hope this is of use to anybody.

    Louis

  2. #2
    gshaw's Avatar
    Join Date
    Sep 2007
    Location
    Essex
    Posts
    2,673
    Thank Post
    168
    Thanked 221 Times in 204 Posts
    Rep Power
    67
    Does this still happen even if you a) set ACLs on the profile share to allow Administrator access and b) set the GPO that's meant to add Administrators to the profile folder security?

  3. #3

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,817
    Thank Post
    272
    Thanked 1,138 Times in 1,034 Posts
    Rep Power
    350
    Personally I've always told users there profiles are not backed up. Do not save any data into your profile as you risk loosing it. It helps with logon's/logoffs etc

  4. #4

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,205
    Thank Post
    876
    Thanked 2,729 Times in 2,308 Posts
    Blog Entries
    11
    Rep Power
    782
    Quote Originally Posted by glennda View Post
    Personally I've always told users there profiles are not backed up. Do not save any data into your profile as you risk loosing it. It helps with logon's/logoffs etc
    Depends on how thick and oblivious your users are.

  5. #5

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,205
    Thank Post
    876
    Thanked 2,729 Times in 2,308 Posts
    Blog Entries
    11
    Rep Power
    782
    Oh there is also a gpo to add the administrators group to the roaming profile folder that should fix the ops issue outright.

  6. #6

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,817
    Thank Post
    272
    Thanked 1,138 Times in 1,034 Posts
    Rep Power
    350
    Quote Originally Posted by SYNACK View Post
    Depends on how thick and oblivious your users are.
    The Words tough or you have lost it come to mind when that happens.

    Alternativly you can run this as a batch file on the file server it will assign the correct permissions to the folders (you need to take ownership first).

    for /d %%1 in (*) do echo y|cacls %%1 /t /g %%1:F administrators:f " "domain admins":f system:f "A N OTHER GROUP":f

  7. #7

    Join Date
    Mar 2012
    Location
    Birmingham
    Posts
    21
    Thank Post
    2
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Yeah, this is the same that happened to me, we tend to back everything up, Roaming Profiles and Home Directories.
    The group policy to allow administrators never resolved this, however, I decided to write a script that changes the permissions from the user it is running at, running this as a login script seemed to solve the problem

SHARE:
+ Post New Thread

Similar Threads

  1. Windows 7 Roaming profile problem
    By timbo343 in forum Windows 7
    Replies: 30
    Last Post: 25th May 2012, 08:41 PM
  2. Windows 7 and XP Mandatory Roaming Profiles
    By voodoochile in forum Windows 7
    Replies: 49
    Last Post: 24th October 2011, 05:36 PM
  3. Windows 7 roaming profiles
    By Blue_Cookeh in forum How do you do....it?
    Replies: 2
    Last Post: 24th August 2011, 04:29 PM
  4. Roaming profile migration failed using Windows explorer manual copy
    By albertwt in forum Windows Server 2000/2003
    Replies: 4
    Last Post: 29th April 2010, 10:08 AM
  5. Roaming Profiles
    By ChrisH in forum Windows
    Replies: 60
    Last Post: 21st November 2005, 10:14 AM

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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