Discussion:
Script to copy a desktop s/cut via login script.
(too old to reply)
Fred Bloggs
2010-01-04 10:22:16 UTC
Permalink
Hi,
I'm trying to get a desktop shortcut pushed out to all users on the network
here, and I've stumbled across this line to add to the login script to do
so.

xcopy \\myDC\NETLOGON\DESKTOP ICONS C:\Documents and Settings\All
Users\Desktop /d /y

my issue is that we have setup the offline sync of mydocs etc and this path
does not exist on every ones pc.

The path it need to go to is going to be C:\users\user.name\desktop

What chane needs to be made to the code to automatically add the shortcut to
anyone's desktop who logs into the pc.

Many thanks
Pegasus [MVP]
2010-01-04 10:30:46 UTC
Permalink
Post by Fred Bloggs
Hi,
I'm trying to get a desktop shortcut pushed out to all users on the
network here, and I've stumbled across this line to add to the login
script to do so.
xcopy \\myDC\NETLOGON\DESKTOP ICONS C:\Documents and Settings\All
Users\Desktop /d /y
my issue is that we have setup the offline sync of mydocs etc and this
path does not exist on every ones pc.
The path it need to go to is going to be C:\users\user.name\desktop
What chane needs to be made to the code to automatically add the shortcut
to anyone's desktop who logs into the pc.
Many thanks
You need to replace

C:\Documents and Settings\All Users\Desktop
with
%UserProfile%
or with
%AllUsersProfile%
depending on which folder you prefer. Note also that the command

xcopy \\myDC\NETLOGON\DESKTOP ICONS C:\Documents and Settings\All
Users\Desktop

will fail. It should read

xcopy "\\myDC\NETLOGON\DESKTOP ICONS" "C:\Documents and Settings\All
Users\Desktop"

or perhaps

xcopy "\\myDC\NETLOGON\DESKTOP ICONS" "%AllUsersProfile%\Desktop"
Fred Bloggs
2010-01-04 11:34:03 UTC
Permalink
Thanks for the script, but what if there is no all users directory as such,
it's hidden, locked and is redirected to the server where things are sync'ed
to.
Is there anyway aside of using "all users" and to use the folder of who ever
is logging in?

Many thanks
Post by Pegasus [MVP]
Post by Fred Bloggs
Hi,
I'm trying to get a desktop shortcut pushed out to all users on the
network here, and I've stumbled across this line to add to the login
script to do so.
xcopy \\myDC\NETLOGON\DESKTOP ICONS C:\Documents and Settings\All
Users\Desktop /d /y
my issue is that we have setup the offline sync of mydocs etc and this
path does not exist on every ones pc.
The path it need to go to is going to be C:\users\user.name\desktop
What chane needs to be made to the code to automatically add the shortcut
to anyone's desktop who logs into the pc.
Many thanks
You need to replace
C:\Documents and Settings\All Users\Desktop
with
%UserProfile%
or with
%AllUsersProfile%
depending on which folder you prefer. Note also that the command
xcopy \\myDC\NETLOGON\DESKTOP ICONS C:\Documents and Settings\All
Users\Desktop
will fail. It should read
xcopy "\\myDC\NETLOGON\DESKTOP ICONS" "C:\Documents and Settings\All
Users\Desktop"
or perhaps
xcopy "\\myDC\NETLOGON\DESKTOP ICONS" "%AllUsersProfile%\Desktop"
Pegasus [MVP]
2010-01-04 12:55:52 UTC
Permalink
Yes, use %UserProfile% as mentioned.
Post by Fred Bloggs
Thanks for the script, but what if there is no all users directory as
such, it's hidden, locked and is redirected to the server where things are
sync'ed to.
Is there anyway aside of using "all users" and to use the folder of who
ever is logging in?
Many thanks
Post by Pegasus [MVP]
Post by Fred Bloggs
Hi,
I'm trying to get a desktop shortcut pushed out to all users on the
network here, and I've stumbled across this line to add to the login
script to do so.
xcopy \\myDC\NETLOGON\DESKTOP ICONS C:\Documents and Settings\All
Users\Desktop /d /y
my issue is that we have setup the offline sync of mydocs etc and this
path does not exist on every ones pc.
The path it need to go to is going to be C:\users\user.name\desktop
What chane needs to be made to the code to automatically add the
shortcut to anyone's desktop who logs into the pc.
Many thanks
You need to replace
C:\Documents and Settings\All Users\Desktop
with
%UserProfile%
or with
%AllUsersProfile%
depending on which folder you prefer. Note also that the command
xcopy \\myDC\NETLOGON\DESKTOP ICONS C:\Documents and Settings\All
Users\Desktop
will fail. It should read
xcopy "\\myDC\NETLOGON\DESKTOP ICONS" "C:\Documents and Settings\All
Users\Desktop"
or perhaps
xcopy "\\myDC\NETLOGON\DESKTOP ICONS" "%AllUsersProfile%\Desktop"
Fred Bloggs
2010-01-04 10:33:16 UTC
Permalink
I meant to say that users have redirected folders
Post by Fred Bloggs
Hi,
I'm trying to get a desktop shortcut pushed out to all users on the
network here, and I've stumbled across this line to add to the login
script to do so.
xcopy \\myDC\NETLOGON\DESKTOP ICONS C:\Documents and Settings\All
Users\Desktop /d /y
my issue is that we have setup the offline sync of mydocs etc and this
path does not exist on every ones pc.
The path it need to go to is going to be C:\users\user.name\desktop
What chane needs to be made to the code to automatically add the shortcut
to anyone's desktop who logs into the pc.
Many thanks
Fred Bloggs
2010-01-04 13:33:04 UTC
Permalink
Hi Pegasus, thats working now, many thanks.

one question though, is there a switch to use in the command to
automatically overwrite the file being copied?
I'm intending to include the line in my login script, but don't want the
users to see a dos prompt each day saying "do you want to overwrite" etc.

Many thanks.
Post by Fred Bloggs
I meant to say that users have redirected folders
Post by Fred Bloggs
Hi,
I'm trying to get a desktop shortcut pushed out to all users on the
network here, and I've stumbled across this line to add to the login
script to do so.
xcopy \\myDC\NETLOGON\DESKTOP ICONS C:\Documents and Settings\All
Users\Desktop /d /y
my issue is that we have setup the offline sync of mydocs etc and this
path does not exist on every ones pc.
The path it need to go to is going to be C:\users\user.name\desktop
What chane needs to be made to the code to automatically add the shortcut
to anyone's desktop who logs into the pc.
Many thanks
Pegasus [MVP]
2010-01-04 16:50:42 UTC
Permalink
There are numerous switches in xcopy, including one to suppress the
overwrite prompt. Type xcopy /? at the Command Prompt to see them all.
Post by Fred Bloggs
Hi Pegasus, thats working now, many thanks.
one question though, is there a switch to use in the command to
automatically overwrite the file being copied?
I'm intending to include the line in my login script, but don't want the
users to see a dos prompt each day saying "do you want to overwrite" etc.
Many thanks.
Post by Fred Bloggs
I meant to say that users have redirected folders
Post by Fred Bloggs
Hi,
I'm trying to get a desktop shortcut pushed out to all users on the
network here, and I've stumbled across this line to add to the login
script to do so.
xcopy \\myDC\NETLOGON\DESKTOP ICONS C:\Documents and Settings\All
Users\Desktop /d /y
my issue is that we have setup the offline sync of mydocs etc and this
path does not exist on every ones pc.
The path it need to go to is going to be C:\users\user.name\desktop
What chane needs to be made to the code to automatically add the
shortcut to anyone's desktop who logs into the pc.
Many thanks
Loading...