Please enable Javascript for better experience...
 
Powershell - Script to Copy and Install *.exe to multiple remote computers
By Pranay Jha | Jul 21, 2016 | In Tips | Update: Jul 21, 2016 | Total Views [ 1169 ]
Taged In
(0 Like)
Rate

Powershell Script to Copy and Install *exe Setup to Multiple Remote Server

While installing any software to multiple remote computers, you may required some automation to avoid manual efforts. Use below powershell script to perform this installation. It will copy setup file to destination folder and execute installation.


#Variables
$computername = Get-Content servers.txt
$sourcefile = "\\server01\Pranay\setup.exe"
#This section will install the software
foreach ($computer in $computername)
{
    $destinationFolder = "\\$computer\C$\Temp"
    #It will copy $sourcefile to the $destinationfolder. If the Folder does not exist it will create it.

    if (!(Test-Path -path $destinationFolder))
    {
        New-Item $destinationFolder -Type Directory
    }
    Copy-Item -Path $sourcefile -Destination $destinationFolder
    Invoke-Command -ComputerName $computer -ScriptBlock {Start-Process 'c:\temp\setup.exe'}
}


Thanks for visiting here. Share this article if you found it useful.
Join Facebook Group https://www.facebook.com/groups/VMwareInsight/
Like Facebook Page https://www.facebook.com/VMwareInsight/
Connect to twitter https://twitter.com/VMwareInsight
Share this on Social Media

About the Author

Pranay Jha
Pranay Jha
Founder, Contributer VMwareInsight.com
Follow me

facebook linkedin twitter G+ VMTN

My name is Pranay Jha, working in IBM as Technical Solution Architect for Virtualization platform. I have been working in IT for near around 10 years. Passionate to get involved as an Independent blogger for my blog http://vmwareinsight.com. I am VMware vExpert 2016/2017, VCAP5-DCD/DCA, VCP5-DCV, VCA-Cloud, VCE-CIA, MCSE, MCITP, MCSA(Messaging). For any query or suggestion, please connect me at pranay1988jha@gmail.com. Thanks for visiting here.

 
Please SignUp/Login to comment...

Or comment as anonymous...
* Name
* Email ID
Comment
 
Sponsors
 
 
 
 
 
Facebook Likes