How to install softwares in other machines using powershell

Dear Folks,
Greetings for the day!

  1. i have VM with admin rights created
  2. i need to install multiple softwares in different machine who works different locations
  3. i need powersheel script if you guys has anyone please share thanks a lot in advance.

Regards
Govi

@GovardhanReddy

It’s depends on which softwares you are installing
every software has it’s own parameters, so better check by searching for software and powershell commands

then you can use Invoke Powershell activity to run using the UiPath

Hope this may help you

Thanks,
Srini

1 Like

@GovardhanReddy please provide which software u want to install as u want silent installation and also which location do you want to use install it based on that we can suggest, if these are common installer then we can suggest it is good to follow documentation from the specific doc

1 Like

Hi @GovardhanReddy

Can you try this powershell script , it is use to install multiple software packages on remote machines.

’ Define the list of remote machines you want to install software on
$computers = “COMPUTER1”, “COMPUTER2”, “COMPUTER3”

'Define the list of software packages you want to install

$software = @(
@{
Name = “Software1”
Path = “\SERVER\SHARE\Software1.exe”
Arguments = “/silent”
},
@{
Name = “Software2”
Path = “\SERVER\SHARE\Software2.msi”
Arguments = “/qn”
},
@{
Name = “Software3”
Path = “\SERVER\SHARE\Software3.exe”
Arguments = “/silent /norestart”
}
)

'Loop through each remote machine and install the software

foreach ($computer in $computers) {
Write-Host “Installing software on $computer…”
foreach ($package in $software) {
Write-Host " Installing $($package.Name)…"
$result = Invoke-Command -ComputerName $computer -ScriptBlock {
& “$($using:package.Path)” $($using:package.Arguments)
}
if ($result.ExitCode -eq 0) {
Write-Host " Successfully installed $($package.Name) on $computer."
}
else {
Write-Host " Failed to install $($package.Name) on $computer."
}
}
}

Replace the values for $computers and $software with the names of the remote machines and the software packages you want to install, respectively.

Thanks!!

1 Like

Dear We have many software’s with silent bats and exe both applications

we have these software’s on VM which is having admin rights

from this VM to other physical machines we have to install who are working in diff locations

image

Thanks bro and tried this but getting some winRM error

@GovardhanReddy

You can try something like this…need to be modified as per your computers and softwares

# Example computer names
$computers = "Computer1", "Computer2", "Computer3"
foreach ($computer in $computers) {
#command on the remote machine
    Invoke-Command -ComputerName $computer -ScriptBlock {
# Example installation for notepad
Start-Process "C:\Software\Notepad++\npp.7.9.5.Installer.exe" -ArgumentList "/S" -Wait
    }
}

Hope this helps

Cheers

@Anil_G

Thanks bro but getting below error

//////command : The term ‘on’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of
the name, or if a path was included, verify that the path is correct and try again.
At line:4 char:1

  • command on the remote machine
  •   + CategoryInfo          : ObjectNotFound: (on:String) [Get-Command], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
    
    

Connecting to remote server FINBLR19 failed with the following error message : The WinRM client cannot process the
request because the server name cannot be resolved. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (FINBLR19:String) , PSRemotingTransportException
+ FullyQualifiedErrorId : ComputerNotFound,PSSessionStateBroken\\\\\\\

@GovardhanReddy

Just modified the above code…it was actually a comment…so commented it out.please use the new one

Also you should have access to the remote machien where you want to install else this might not work

Cheers

1 Like

@Anil_G

Thank You again

getting below

[FINLR19] Connecting to remote server FINLR19 failed with the following error message : The WinRM client cannot process the
request because the server name cannot be resolved. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (FINLR19:String) , PSRemotingTransportException
+ FullyQualifiedErrorId : ComputerNotFound,PSSessionStateBroken

is this because of access issue?

@GovardhanReddy

Yes this is the access issue…remote server you are trying is either not up or the name is wrong or is not available to connect

Cheers

1 Like

Firewall blocked

1 Like