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.