Solved

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

Posted on 2013-11-29
4
528 Views
Last Modified: 2013-12-19
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.
0
Comment
Question by:rpremuz
  • 2
  • 2
4 Comments
 
LVL 23

Expert Comment

by:Coralon
ID: 39687682
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
0
 

Author Comment

by:rpremuz
ID: 39692397
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.
0
 
LVL 23

Accepted Solution

by:
Coralon earned 250 total points
ID: 39694454
That surprises me.. thinking back, I don't remember creating a link to a remote point in Win2k3. I remember doing a lot of local links.

If it really doesn't work, then your next option is to copy them back at logoff, and that is probably your only option?

Coralon
0
 

Author Closing Comment

by:rpremuz
ID: 39730103
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.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I hope this helps those who have been battling the SanDisk / U3 problem for a while. For anyone that is running Windows 7 64bit and is receiving and searching the internet for the “Windows Error: Windows has allocated a drive letter to the U3 dri…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now