Jump to content

Recommended Posts

Posted

Hi gang,

 

Something's stopped me being clever this morning.

I've got a shortcut file that I want to put on admin users desktops. I've already written it into the logon script as a simple copy command from a network location to Documents and Settings\All Users\Desktop so tomorrow it won't be a problem.

 

However, I'm impatient and want it there now.

Can the copy command be used to run a batch now to copy this shortcut to the desktop of every admin computer currently on? Can it be done without using GP?

 

Someone suggested somewhere that...

 

copy \\server\file.lnk "\\%computername%.mydomain.local\c$\Documents and Settings\All Users\Desktop\file.lnk"

... might work but it didn't.

Posted

youd need to have a list of all the computers in a text file

 

and then do a for loop to loop through all the entries in the text file

 

gimme a min ill knock up the exact syntax

Posted

If you are running it in the local computers context.

 

copy \\server\file.lnk "%allusersprofile%\Desktop\file.lnk"

Posted

FOR %%A IN (pc1 pc2 pc3 etc etc) DO copy \\server\file.lnk "\\%%A.mydomain.local\c$\Documents and Settings\All Users\Desktop\file.lnk"

 

The above might work, I don't have time to test it.

 

With Powershell or VBS you should be able to do a script that reads the computernames from AD.

Posted

this should work,

 

xcopy \\server\file.lnk \\%computername%.mydomain.local\c$\DOCUME~1\ALLUSE~1\DESKTOP\file.lnk

 

or

 

xcopy \\server\file.lnk \\%computername%\c$\DOCUME~1\ALLUSE~1\DESKTOP\file.lnk

 

 

i don't normaly use the domaim.local

if you use it in a batch file, dont think batch can take the spaces,

 

edit - the website has put a space between alluse~1 on the top line and file.lnk on the 2nd line but there shouldnt be

Posted

I do this sometiomes frequently via a script I picked up ... I posted it in another thread.

 

Try this script that I have used (attatched) which I use sometimes to patch remote machines.

 

You'll need to add machines you want to deploy to a group - I use STRCCWorkstations (schoolname, workstation).

 

You can add command line parameters too after you have specified the install file - Installing IE7 Silently is Simple… | So Joe... should help you.

 

Hope it works! (it does here! ).

 

Another note - if you have windows firewall on you need to make sure WMI is allowed as an exception - you can do it via GPO - but that's for another time...!

 

 

You may be able to do something with it...

 

 

rh91uk

Patch remote PCs.vbs

Posted

Hi

 

I dont know if you could do this but it might be easier.

 

Create a share on a server and assign the admin users read permission on the share and the ntfs permissions.

 

Copy the short cuts or icons in the share

 

Now create a group policy that will only apply to one test user of admin and call it redirect desktop.

 

Now edit the gpo and set the path to the share, set the grant users exclusive access to disable, move content of desktop to disable, policy removal behavior to restore content.

 

Find a admin computer and run gpupdate /force /boot. This will update group policy and reboot the pc.

 

Log on as the test user and you should get the normal icon from all users on the machine and the redirected desktop.

 

The only problem with this is if users have been storing things on the desktop which I dont allow because I don't backup individual pcs and only backup the servers.

 

Just an idea.

 

Richard

Posted

Sometimes when I want to be quick and dirty about something i'll use psexec. In your case i'd just have a batch file located on a network share that runs the copy command. Then i'd create a text file that contains a list of the machines i want to hit. I usually use a program called lookatlan to scan the network and do an export. Then i'll just execute this command psexec @c:\computer.txt -u domain\user -d "\\server\share\copy.bat"

 

There actually is away to use group policy to place a shortcut on a desktop as well. Currently I'm using Win 7 and if you are using you GPO Management you can goto Computer Config/Preferences/Windows Settings/Files Here just do a file replace of the ICO image for your shortcut. Then go to Config/Preferences/Windows Settings/Shortcuts then just create the shortcut you want.

  • 2 weeks later...
Posted

Asanders,

What copy command do you use in your batch file? I understand the @file option. I dont understand how a remote copy command will copy the proper file to all of the computers in the computer.txt file. Dont you have to specify the file to be copied and the destination in the copy command?

 

copy c:\folder\test.txt "\\remote computer\folder"

 

How does the computer.txt file replace the remote computer?

Posted

Think of PSExec like this it allows you to remotely execute a command on a machine. In this case we just want to run a batch file. I'll try and create a step by step example for you

 

Step 1. Create batch file called copy.bat and place it on a network share that can be accessed by everyone. ie \\server\share

Step 2. Place the shortcut you want in the same network share as copy.bat ie \\server\share\Shortcut.lnk

Step 3. Edit copy.bat and type this

copy "\\server\share\Shortcut.lnk" "C:\Documents and Settings\All Users\Desktop\"

Step 4. Create a text file called computers.txt in the root of your C:\ and in that file just list your computers you want this batch file to run on.

ie. Computer1

Computer2

Computer3

Computer4

**Note The reason we are creating this text file is because we want a list of computer names and psexec will execute the batch file on every computer that is listed in that text file.

Step 5. In CMD type this "psexec @C:\computers.txt -u domain\UserWithAdminRights -p Pa$$Word -d "\\server\share\copy.bat"

 

**Note that I added this -d because I just want the batch file to run and disconnect. Otherwise you will see the batch file run on each computer and well that can take forever.

  • Thanks 1
Posted

Asanders,

Thank you for the information. I knew psexec would be able to copy the files I needed across the network but I could not figure out how to do it. This makes my life so much easier. Thanks for your help. It is working like a charm.

  • 2 years later...
Posted
Think of PSExec like this it allows you to remotely execute a command on a machine. In this case we just want to run a batch file. I'll try and create a step by step example for you

 

Step 1. Create batch file called copy.bat and place it on a network share that can be accessed by everyone. ie \\server\share

Step 2. Place the shortcut you want in the same network share as copy.bat ie \\server\share\Shortcut.lnk

Step 3. Edit copy.bat and type this

copy "\\server\share\Shortcut.lnk" "C:\Documents and Settings\All Users\Desktop\"

Step 4. Create a text file called computers.txt in the root of your C:\ and in that file just list your computers you want this batch file to run on.

ie. Computer1

Computer2

Computer3

Computer4

**Note The reason we are creating this text file is because we want a list of computer names and psexec will execute the batch file on every computer that is listed in that text file.

Step 5. In CMD type this "psexec @C:\computers.txt -u domain\UserWithAdminRights -p Pa$$Word -d "\\server\share\copy.bat"

 

**Note that I added this -d because I just want the batch file to run and disconnect. Otherwise you will see the batch file run on each computer and well that can take forever.

 

I followed your instructions however on all of my workstation names it says

 

\\workstation

The filename, directory name, or volume label syntax is incorrect

 

Am I supposed to add anything else to the computer.txt file?

Posted
I followed your instructions however on all of my workstation names it says

 

\\workstation

The filename, directory name, or volume label syntax is incorrect

 

Am I supposed to add anything else to the computer.txt file?

 

What exactly are you putting in your text file? e.g. Are you doing "ComputerName" ? If so it'll probably need to be "\\ComputerName" etc etc

 

Can you access your workstations through normal UNC paths, either in run box, or explorer etc?

 

Could be your server name isn't recognised either, best check that.

 

If you don't mind, it'd help if you posted the whole script you're trying (both parts), could just be a typo etc

 

Could be many things :)

 

Steve

Posted
What exactly are you putting in your text file? e.g. Are you doing "ComputerName" ? If so it'll probably need to be "\\ComputerName" etc etc

 

Can you access your workstations through normal UNC paths, either in run box, or explorer etc?

 

Could be your server name isn't recognised either, best check that.

 

If you don't mind, it'd help if you posted the whole script you're trying (both parts), could just be a typo etc

 

Could be many things :)

 

Steve

 

I agree with Steve it could be a simple a typo. Could you post the command syntax that you are using? Tip I would suggest just running CMD on the remote machine and than try the command you want to run.

 

psexec \\computer1 -u domain\username -p Pa$$w0rd cmd

 

This helps when you are trying to trouble shoot if it is the command you type into psexec or just the command itself is the problem.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...