how to install .exe files

Welcome Forums General PowerShell Q&A how to install .exe files

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
1 year, 3 months ago.

  • Author
    Posts
  • #78382

    Participant
    Points: 0
    Rank: Member

    I am trying to install McAfee Virus Scan with Powershell.
    I am using the following Script.

    $file = '\\fileserver\share\SetupVSE.exe'
    $computerName = 'server01'
    
    Copy-Item -Path $file -Destination "\\$computername\c$\windows\temp\SetupVSE.exe"
    Invoke-Command -ComputerName $computerName -ScriptBlock {
        c:\windows\temp\SetupVSE.exe /silent
    }
    

    The problem is that Mcafee SetupVSE.exe calls on other files in the folder to do the install.
    So it will run but not install and does not give any errors.
    Is there a way I can copy the whole folder and not just the file?
    Or better yet I way to simply install it right from the network share without having to copying any files?

    Thank you

  • #78401

    Participant
    Points: 1
    Rank: Member

    I'm not sure if you can install that right from the network share. I would think it would depend on the software itself. As for how to copy the entire (share) folder that the .exe sits in, just add the -Recurse parameter to the Copy-Item cmdlet. The entire folder, and everything underneath it, will be copied.

  • #78407

    Participant
    Points: 1
    Rank: Member

    If you don't want to copy the "share" folder itself into the "temp" folder, but rather you just want the contents of what's in the "share" folder to be copied into the "temp" folder, then replace:

    $file = '\\fileserver\share\SetupVSE.exe'

    with

    $file = "\\fileserver\share\*"

    If there are folders under the "share" folder whose contents all need to be copied as well, then, as mentioned earlier, you'll need to add the -Recurse parameter to the Copy-Item command.

The topic ‘how to install .exe files’ is closed to new replies.