In the code below I can copy the Google Drive client to a remote computer and silently install it. I know it’s not much, but its the coolest thing I have created with PowerShell and I am kind of proud of it.
Anyway, what can I do to see if the command succeeded or not? I work at a school and I might use this to target all teacher computers or a specific computer lab.
$pc_names = @(Get-ADComputer -Filter {name -like '*OrgPC01*'} | select -expand name)
Foreach ($pc in $pc_names)
{
Copy-Item -Path C:\Users\kyle\Downloads\gsync_enterprise.msi -Destination "\\$pc\C$\software" -Recurse
Invoke-Command -ComputerName $pc -ScriptBlock {Start-Process "msiexec.exe" -ArgumentList "/i C:\software\gsync_enterprise.msi /qn" -Wait}
}