Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

help for unattended software installation

$
0
0

HI,

Need help in installing the software's using PowerShell.

At my knowledge i have created a script but it need manual intervention to install. please help in doing unattended installation.

Set-ExecutionPolicy RemoteSigned -ErrorAction SilentlyContinue
$ServerName = Get-content -path "C:\Users\Administrator\Servers.txt"
$sourcefile = "C:\Users\Administrator\Desktop\software\wrar420sw.exe"
foreach ($ComputerName in $Servername)
{
 $destinationFolder = "C:\Tempsoftware"
  if (!(Test-Path -path $destinationFolder))
 {
  New-Item $destinationFolder -Type Directory
 }
 Copy-Item -Path $sourcefile -Destination $destinationFolder
  $Setup=Start-Process "C:\tempSoftware\wrar420sw.exe" -ArgumentList "/s" -Wait -PassThru
    if ($setup.exitcode -eq 0) {
 $result = "The Installation of wrar is Successful"
 $date = get-date -format g
    }
    else
    {
    $result = "The Installation of wrar is Failed "
 $date = get-date -format g
    } 
write-host $result
 Out-File -FilePath C:\tempSoftware\wrar.txt -Append -InputObject ("ComputerName: $computerName Result: $result $date")
}


Viewing all articles
Browse latest Browse all 6937

Trending Articles