We help IT Professionals succeed at work.

New podcast episode! Our very own Community Manager, Rob Jurd, gives his insight on the value of an online community. Listen Now!

x

Need PSEXEC help to deploy .exe and .reg files to client machines

401 Views
Last Modified: 2017-05-03
Please help come up with a PSEXEC (silent install) command to do the following:

1. Execute InstallDPRAdllFiles.exe from the following share:

2017-04-18_15-03-07.jpg

2. The share will have a Computers.txt file which contains the client IPs to deploy this app to.

3. The command will also need to execute the DPRARegistry.reg file on the client's computer.

4. The command should also reboot the clients computer once the .exe and the reg have been executed.

I will be running the PSEXEC command from another server (e.g. - Server2).

Please detail the PSEXEC command I must run from Server2 to accomplish this given the scenario above. Thank you.
2017-01-17_13-16-02.jpg
Comment
Watch Question

David Johnson, CDSimple Geek from the '70s
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Powershell
$servershare  = "\\Server1\TempSoftware\DPRA\"
$computerfile = $severshare + "computers.txt"
if(!(Test-Path ($servershare + $computerfile))){
  write-verbose ("$computerfile Not Found") -Verbose
  }
else {
  $computers = get-content $computerfile
  foreach($computer in $computers)
    { 
    invoke-command -ComputerName $computer -ScriptBlock {
      start-process $servershare\InstallDPRAdllFiles.exe -Wait
      Start-Process reg /import $servershare\DPRARgistry.reg -Wait
      shutdown -r -t 0 /m \\$computer
      }
    }
}

Open in new window

Author

Commented:
Hello David,

I have no experience with powershell, but I did try to run your script in Powershell but receive some errors.

1. First time I ran it, I receive the following error.

2017-04-19_21-36-01.jpg
2. Because of the error from the above, I disabled Windows firewall and enabled WRM from one of the client machine I am testing with. I did the same on Server2, and Server1. I ran the script again and received the following message.

 2017-04-19_21-44-53.jpg
Can you identify what I did wrong? Can this be executed via PSEXEC? If so, can you tell me what commands I have to execute? Thanks for your effort.
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
The script has not been able to see the computers.txt file on the share you provided, which is strange because in your first attempt it has been there, otherwise you would not have received that WinRM error ...

But if using PS, I would make use of the multi-threading feature, working on more than one machine at a time:
$servershare  = "\\Server1\TempSoftware\DPRA"
$computerfile = $severshare + "\computers.txt"
invoke-command -ComputerName (get-content $computerfile) -ScriptBlock {
      start-process $servershare\InstallDPRAdllFiles.exe -Wait
      Start-Process reg /import $servershare\DPRARgistry.reg -Wait
      shutdown /r /t 0 
}

Open in new window

Author

Commented:
Hello Qlemo,

I attempted to execute your script from Server2, but got the following results:

2017-04-21_15-32-30.jpg
Maybe if I provide you the details that IBM vendor needs me to do to mass deploy this app to client machines, that might give you an idea on what needs to be done. I hope this helps (message from IBM vendor):

2017-04-21_15-42-31.jpg
David Johnson, CDSimple Geek from the '70s
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
Yes to the typo, which has been obvious with that error message. But no to the change of the current directory, it needs to be a single line, and even that might fail for external commands. So
      c:
      set-location -path  \windows\system32

Open in new window

should be
      set-location c:\windows\system32

Open in new window

or better
      set-location $env:WinDir\system32

Open in new window

Author

Commented:
I executed the scripte but get the following below. Please advise.

2017-04-24_8-03-34.jpg
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
This line
if(!(Test-Path ($servershare + $computerfile))){

Open in new window

needs to be
if(!(Test-Path $computerfile)){

Open in new window

Author

Commented:
Hello Qlemo,

I ran the script as you have detailed, but still no luck. I get the error below. Please advise.

2017-04-27_11-38-12.jpg
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
Oh yes. you are providing IP addresses ... That does not allow for using Kerberos and hence implicit domain authentication. If in a domain, switch to computer names - then Kerberos is used.
If you are not (staying) in a domain, IP addresses and explicit authentication need to be used, and you need to change settings on your local host as mentioned in the error message.

Author

Commented:
As a test, I enabled Windows Remote Management (WS-Management) on the destination computer that I am trying to deploy the app to.  I tried the Powershell script again. I now get the following error. Please advise.

2017-05-01_10-09-25.jpg
"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks to the both of you for all your efforts. Although I was never able to pull this off in my environment, we decided that we will go around the sneaker net method to do the install one-by-one. I do appreciate the sample PS script.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.