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 ...
13th July 2012, 12:50 PM #1
- Rep Power
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.
This script should be saved as a VBS and the file paths should be set to match your network environment.
'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"
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.
' 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.
' MsgBox "Permissions Will now be set, this may take a while" 'Debugging Line, this can be commented out.
' Msgbox "Permissions Have Now Been Set" 'Debugging Line, this can be commented out.
'Wscript.Echo "Permissions Successfully Set!" 'Debugging Line, this can be commented out.
Hope this is of use to anybody.
IDG Tech News
13th July 2012, 05:12 PM #2
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?
13th July 2012, 05:23 PM #3
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
13th July 2012, 06:05 PM #4
Depends on how thick and oblivious your users are.
Originally Posted by glennda
13th July 2012, 06:07 PM #5
Oh there is also a gpo to add the administrators group to the roaming profile folder that should fix the ops issue outright.
13th July 2012, 06:09 PM #6
The Words tough or you have lost it come to mind when that happens.
Originally Posted by SYNACK
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
16th July 2012, 09:03 AM #7
- Rep Power
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
By timbo343 in forum Windows 7
Last Post: 25th May 2012, 09:41 PM
By voodoochile in forum Windows 7
Last Post: 24th October 2011, 06:36 PM
By Blue_Cookeh in forum How do you do....it?
Last Post: 24th August 2011, 05:29 PM
By albertwt in forum Windows Server 2000/2003
Last Post: 29th April 2010, 11:08 AM
By ChrisH in forum Windows
Last Post: 21st November 2005, 11:14 AM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread