Link to home
Start Free TrialLog in
Avatar of rpremuz
rpremuzFlag for Croatia

asked on

how to link "photo stream" from a network share directory to a local directory

Hi!

In a Windows AD domain the folder redirection GPO is used so that users' "My Documents" is redirected to "\\server\share\%username%" when each user logs on to a Windows client machine. The server runs Windows Server 2003 SP3 while client machines run Windows 7 Pro. SP1.

On client machines there are some applications that put a lot of pictures in the following directory:
"My Documents\My Pictures\Photo Stream"
and so the server share gets filled with users' private pictures, which we want to avoid.

In this environment, how to create a symbolic link that links
"\\server\share\%username%\My Pictures\Photo Stream"
to a folder on the local disk, e. g. "C:\foobar\%username%\Photo Stream", so that when an application stores pictures to "My Documents\My Pictures\Photo Stream" they actually go to the local disk?

I've tried to achieve this with "mklink /d" command in Command Prompt but it does't work (the link is created but it is not accessible).

-- rpr.
Avatar of Coralon
Coralon
Flag of United States of America image

In theory, you could use a different policy for My Pictures as compared to My Documents.

But, based on your original question/idea:
They have to have permissions to get to that directory.  In fact, the more I think about this, the more I suspect that this is your issue.

*IF* your users have local admin rights, then you should be able to script out a link creation on the server that redirects to the client drive.  

Ok, so given this scenario:
Existing location - "\\server\share\%username%\My Pictures\Photo Stream"
The user will *have* to have Full Control at the My Pictures directory.
You will have to remove the Photo Stream directory.  Let's assume that this needs to be automated also.

In theory:
pushd "\\server\share\%username%\My Pictures"
if exist "Photo Stream" robocopy /e /move "Photo Stream" \\%computername%\c$\foobar\%username%\Photo Stream"
mklink /d "Photo Stream" "\\%computername%\c$\foobar\%username%\Photo Stream"
popd

Open in new window

Also, you may need to try adding the /h to the mklink command, or possibly a /j.

But, if they do not have access to C$ (not admins) then you will need to precreate a share on each of the machines, and give them full control of those shares, and of the destination NTFS directories (modify/change might be enough).    

You can also do all of this by hand, assuming you had a list of the user's machines.
So, for example -- let's say you had a delimited text file:
user1,machine1
user2,machine2
user3,machine3

Open in new window


So, on the server, and having all your user directories in the same directory.
for /f "tokens=1,2 delims=," %f in (usermachines.txt) do robocopy /e /move "%f\My Pictures\Photo Stream" "\\%g\c$\foobar\%f\Photo Stream"
for /f "tokens=1,2 delims=," %f in (usermachines.txt) do mklink /d "%f\My Pictures\Photo Stream" "\\%g\c$\foobar\%f\Photo Stream"

Open in new window


Again, they must be local admins, or you will need to replace c$ with a different share.

Coralon
Avatar of rpremuz

ASKER

Coralon,

our users don't have local admin rights, so a normal share should be used instead of C$.

But, any of the commands for creating symbolic links I tried don't work with UNC paths. It seems that Windows Server 2003 does not support that feature -- see
http://superuser.com/questions/355214/how-can-i-create-a-directory-symbolic-link-on-windows-server-2003

Windows Server 2003 doesn't have mklink command, only linkd.exe (from Windows Server 2003 Resource Kit) and junction.exe (from Sysinternals) but they both don't work with UNC paths.

Here is output of commands tried on the server on the NTFS volume which holds \\server\share mentioned below:
linkd "Photo Stream" "\\pc\share\foobar\Photo Stream"
Cannot create a link at: Photo Stream


junction "Photo Stream" "\\pc\share\foobar\Photo Stream"

Junction v1.06 - Windows junction creator and reparse point viewer
Copyright (C) 2000-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

Error setting junction for Photo Stream:
The data present in the reparse point buffer is invalid.

Open in new window


On the other hand, mklink succeeds on Windows 7:
pushd "\\server\share\username\My Pictures"
mklink /d "Photo Stream" "\\pc\share\foobar\Photo Stream"
symbolic link created for Photo Stream <<===>> \\pc\share\foobar\Photo Stream
popd

Open in new window

but the link cannot be used: Windows Explorer on Windows 7 says "Photo Stream is not accessible" when you double click the folder.

In command line on Windows 7 I get:
pushd "\\server\share\username\My Pictures\Photo Stream"
The file cannot be accessed by the system.

Open in new window

I can only create the "Photo Stream" shortcut (via Windows Explorer) which links to a directory on local HDD but shortcuts only work in Windows Explorer and applications generally don't regard them as symbolic links.

-- rpr.
ASKER CERTIFIED SOLUTION
Avatar of Coralon
Coralon
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rpremuz

ASKER

Actually, this is not a solution but just a workaround. A logoff script can copy photo stream pictures from the network share to a local drive but that slows down the logoff, which users don't like.