how to install .exe files

This topic contains 2 replies, has 2 voices, and was last updated by  Kevyn 6 months, 3 weeks ago.

  • Author
  • #78382


    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


    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


    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'


    $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.

You must be logged in to reply to this topic.