I need help in pushing an Atera agent to around 80+ pc's I did that with GPO, the thing is that I finding my self asking people to do a restart to the computer in order to update the gpo, becouse most of the time they don't want to GPUPDATE.
So at the begning I was thinking of using invoke-command and running a command with the installation of the MSI, this didn't worked so well, had to many strange errors, then I used PSEXEC and it worked when I run it on single pc, but when I wanted to run it in a PS script it didn't worke.
Here is the code:
# Set the path to the text file containing the list of computer names
$computerList = "C:\Users\rvm\Desktop\pclist.txt"
# Set the path to the MSI package
$msiPath = "\\fs\Atera\setup.msi"
# Set the username and password for the remote computers
$username = "blah\blah"
$password = "blah"
# Read the computer names from the text file
$computers = Get-Content $computerList
# Loop through each computer in the list
foreach ($computer in $computers) {
# Run the psexec command for the current computer
$psexecCommand = "psexec \\$computer -u $username -p $password -h cmd /c `"msiexec.exe /i `"$msiPath`" /qn`""
Invoke-Expression $psexecCommand
}
Thank you for your help.