Solved

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

Posted on 2013-11-29
4
531 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 24

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 24

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

813 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

15 Experts available now in Live!

Get 1:1 Help Now