Announcement

Collapse
No announcement yet.

Folder redirection and Scripts

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Folder redirection and Scripts

    I wrote a simple script that copies a file from an application to the user his profile when login on.
    It very simple and works well when using local profiles, but as we are talking Citrix (Terminal Servers), some folders of the profile are redirected to a file share.

    I saw that the redirection does not work with the script.

    Three folders are redirected:
    1. Application Data
    2. My Documents
    3. Desktop


    The script copies a word template from an application to the template folder under the user profile.

    Code:
    set "source=C:\Program Files\Application\Templates"
    set "Target=%Userprofile%\Application Data\Microsoft\Templates"
    Set "File=PKSReporter.dot"
    
    If Not Exist "%Target%\%File%",(
        xCopy "%Source%\%File%" "%Target%" /I /C /Q
       )
      )
     )
    So as reported, it works well local, but when a redirection is in place, the script isn't redirected. It just creates the folders Application Data\Microsoft\Templates where it copies the file. While for what i believe the application data should be redirected to the share. It isn't the redirection which is failing cause MS Word is creating its structure on the file share when it is launced the first time.

    First i taught the problem was caused in the order the policies where processed, but changing the processing order doesn't affect the outcome.

    As this is Windows Server 2003 R2, command.com and 16/32 bit isn't an issue here.
    [Powershell]
    Start-DayDream
    Set-Location Malibu Beach
    Get-Drink
    Lay-Back
    Start-Sleep
    ....
    Wake-Up!
    Resume-Service
    Write-Warning
    [/Powershell]

    BLOG: Therealshrimp.blogspot.com

  • #2
    Re: Folder redirection and Scripts

    Originally posted by Killerbe View Post

    some folders of the profile are redirected to a file share.

    Three folders are redirected:
    1. Application Data
    2. My Documents
    3. Desktop


    The script copies a word template from an application to the template folder under the user profile.
    So you cannot use the environment variable %Userprofile% since you redirected the target subfolders.
    Replace %Userprofile% with: UNCpath\%username%

    Code:
    @ECHO off
    SETLOCAL
    (Set Userprofile=UNCpath\%username%)
    
    set "source=C:\Program Files\Application\Templates"
    set "Target=%Userprofile%\Application Data\Microsoft\Templates"
    Set "File=PKSReporter.dot"
    
    If Not Exist "%Target%\%File%" (
        xCopy "%Source%\%File%" "%Target%\" /I /C /Q
    )
    ENDLOCAL
    \Rems

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment

    Working...
    X