wicked
October 11, 2020, 6:17am
1
hello
im new to powershell
im looking for the simplest way to remotely install an exe to computers listed in a csv file
from my local machine
i ran this script with no errors but it didnt do anything either :
all the computers in the csv file are under “name”
$computers = Import-CSV "[Path to csv]"
foreach($computer in $_name){
Copy-Item "C:\sentinel one\SentinelAgent_windows_v4_2_4_154.exe" \\$computer\c$\windows\temp
Invoke-Command -ComputerName $computer -ScriptBlock {
Start-Process "SentinelAgent_windows_v4_2_4_154.exe"/SITE_TOKEN=** /QUIET /NORESTART
}
}
thanks!
wicked
October 12, 2020, 1:13am
3
hey kiran
thank you very much for your reply
i ran the script and didnt noticed any errors however i dont see the file getting copied or the exe getting installed…
First, check your csv file, and see the output of $Computers
If you see your servers list, then try with one server, and execute the commands one by one with the direct path and see how it works.
wicked
October 12, 2020, 3:58am
5
yep typo in the csv file
moving forward - the file got copied to the server but the exe didnt run
Did you notice any error?
Try running the command directly on the remote computer and see the outcome. Also, check to replace the site token in the argument list.
Start-Process -FilePath "C:\Windows\Temp\SentinelAgent_windows_v4_2_4_154.exe" -ArgumentList "/SITE_TOKEN=** /QUIET /NORESTART" -Wait
Thank you.
wicked
October 13, 2020, 2:21am
7
running the command locally only runs the exe a pop up dialog box asking if you want to install the app guess -ArgumentList is ignored
Go through the Start-Process
help and try to see anything that you are missing…
Thank you.
First, have you tested this Start-Process on a local system to ensure it runs and works properly? The documentation recommends a push via CLI,SCCM or GPO. Each of these methods are most likely installing the software as SYSTEM. Have you attempted a local installation with the credentials you are using with Invoke-Command? Unfortunately, the documentation doesn’t appear to have installation logging, but have you looked at event viewer for failures as well?