-
Notifications
You must be signed in to change notification settings - Fork 49
Autofix Broken Agents
Warning - Some of the commands below can Impact your agents so proceed with care
Please note - to run these tasks successfully your agents need to be able to access the URL https://raw.githubusercontent.com/LabtechConsulting/LabTech-Powershell-Module/master/LabTech.psm1 - if you have problems you may need to whitelist this URL
Get-AutomateComputer -Online $False | Compare-AutomateControlStatus
which will give you a list of Computers that are online in Control and Offline in Automate. You can also run Compare-AutomateControlStatus
on its own which will check all machines in Automate. If you want to return every session comparison between Automate and Control, you can do $Object = Compare-AutomateControlStatus -AllResults
Get-AutomateComputer -Online $False | Compare-AutomateControlStatus | Repair-AutomateAgent -Action Restart
Get-AutomateComputer -Online $False | Compare-AutomateControlStatus | Repair-AutomateAgent -Action Update
If it is still broken, do a reinstall
Get-AutomateComputer -Online $False | Compare-AutomateControlStatus | Repair-AutomateAgent -Action Reinstall
In basic terms it gets a list of computers, checks their status versus the equivalent status in control, then initialises commands using https://github.com/LabtechConsulting/LabTech-Powershell-Module to either restart services or reinstall an agent. It then returns an object of the results.
Available at present are Update, Restart, ReInstall and Check.
Check runs: (new-object Net.WebClient).DownloadString('http://bit.ly/LTPoSh') | iex; Get-LTServiceInfo
Update runs: (new-object Net.WebClient).DownloadString('http://bit.ly/LTPoSh') | iex; Update-LTService
Restart runs: (new-object Net.WebClient).DownloadString('http://bit.ly/LTPoSh') | iex; Restart-LTService
Reinstall runs: (new-object Net.WebClient).DownloadString('http://bit.ly/LTPoSh') | iex; ReInstall-LTService
In the commands above you will be prompted for each agent it finds and you can press y or n to process them
Add -Confirm:$false
to the parameters on Repair-AutomateAgent