Jump to content

Recommended Posts

Posted

I have software to install on lots of PC's. It's educational, and thus rubbish. After install, I need to copy a file from our network to the local machine in order to make it work properly. If the command prompt isn't an Administrative one, it returns Access Denied, so I have to install the software and then RC-Run as Administrator on lots of PC's. I don't want to use RUNAS because this would require me putting my password in on each of the PC's and that kind of defeats the object.

 

I've tried creating a shortcut which runs as an administrator, which works, and launches an Administrative cmd with a mere pressing of a 'Yes' buttom (requiring a left-enter which can be done much quicker than typing a password 30+ times), but I can't seem to find a way to make that prompt automatically run a batch file, so that I can just remotely push the file out to x-amount of PC's and have it install via msciexec.

 

I've tried a batch file of M:\acmd.lnk "\\Batch Location" but that doesn't work, it just loads up a regular cmd, then an Administrative cmd, but the Administrative one doesn't run the batch file (at "\\Batch Location"). So I tried modifying the location of M:\acmd.lnk to C:\Windows\System32\cmd.exe "\\Batch Location", but that has only the same result, only with just one CMD window this time.

 

Any ideas? The batch file in question is simply an MSIEXEC and an XCOPY, if it matters.

Posted
After install, I need to copy a file from our network to the local machine in order to make it work properly. If the command prompt isn't an Administrative one, it returns Access Denied, so I have to install the software and then RC-Run as Administrator on lots of PC's.

 

I use AutoIT, which has a selection of runas / requireadmin commands to run various command lines as a particular user. It will compile its scripts up into a self-executing EXE file, so you don't have to distribute your password in the clear to all machines.

  • 2 months later...
Posted

How about running whatever file you need through psexec?

 

psexec @%labList% -h -n 5 c:\deploy\installTemp\install.bat

 

That's what we use....

Posted (edited)

All good answers so far. For my 2p worth.

 

Open the elevated command prompt from your server (however you like) - you need only open it once and type the password once.

 

Then use PSExec as @MordyT described to copy the file from the remote location to the target PC's. I'm presuming the elevated command prompt uses credentials which will authenticate against the target PC's (locally or at domain level) and have access over the directory which needs to receive the extra file.

 

The PC's can be listed in a single text file (where @MordyT wrote @%lablist%).

 

If you get the command right PSExec can copy the file from the network location to the local disk and loop through the text file to work on each of the target machines.

Edited by superfletch
Posted

It's fine, chaps, I still never figured out how to do it (we don't have any of the programs you guys suggested in our image, I was hoping for a non-third-party way but that's not always the case) and I expect this problem will rear its head again in the future. So I'm still open to ideas. Your necrobump is forgiven.

I ended up writing a small batch file to replace said file and RC-Run as Administrator on every PC.

 

Thank goodness for NetSupport and its mass-logon (shame the mass-run can't run as admin, 'eh?)

Posted
(we don't have any of the programs you guys suggested in our image

From memory, though feel free to correct me, you don't actually need PSExec in your image on the PCs - you only need it on your own PC/server as it installs itself as a service, runs, then removes itself.

 

Many people do also put it (and the rest of PStools) on their PCs, but I don't think it's needed.

 

Peter

Posted
From memory, though feel free to correct me, you don't actually need PSExec in your image on the PCs - you only need it on your own PC/server as it installs itself as a service, runs, then removes itself.

 

Many people do also put it (and the rest of PStools) on their PCs, but I don't think it's needed.

 

Peter

 

This is correct. It only needs to be on the pc running the command. I don't know about it installing/removing a service on the client though...

Although, if you want psexec on each pc, you can install it with psexec after deployment.. :)

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...