Jump to content

Braingears

Members
  • Content Count

    16
  • Joined

  • Last visited

Community Reputation

2 Neutral

My Information

  • Agent Count
    1500+

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Braingears

    Removing ScreenConnect Client

    https://docs.connectwise.com/ConnectWise_Control_Documentation/Get_started/Knowledge_base/Manually_remove_an_access_agent wmic product where name="ScreenConnect Client (xxxxxxxxxxxxxxxx)" call uninstall /nointeractive
  2. When you execute the reboot, perform a script sleep for 3-5 minutes. This way, the Automate Script will not attempt to execute the next function/command until after the computer has rebooted. After the sleep has expired, and the Automate agent is back online, it will continue exactly where it left off.
  3. Braingears

    Pass parameters from LT script to Powershell script

    Function: Execute Script Script Type: PowerShell Bypass Script Credentials: Run as Local Agent in the Script to Execute, this is what I use to convert Automate Variables into PowerShell Variables; in this case PSCredentials: $CredUser = '%computeruserdomain%' $CredPass = '%computerpassword%' $CredPassword = $CredPass | ConvertTo-SecureString -asPlainText -Force $Credential = New-Object System.Management.Automation.PSCredential($CredUser,$CredPassword) and then use them like you would with any PSCredential: ...} -Credential $Credential
  4. Braingears

    Remove another MSP LT Agent

    I updated the Rip & Replace PowerShell script yesterday. It will check: • If an agent is not already installed, it will download the agent and install silently. • If an agent is already installed, it will compare the existing server it's checking into, if it's your automate server, it will comment that it's already installed. If it's another MSP, it will download the uninstaller, run it, then download and install your agent to the same computer. At the end, it will give you confirmation that it's checking in along with the ComputerID in Automate.
  5. Braingears

    Automate Install - Rip & Replace - Powershell

    Update to verify if YOUR agent is already installed. If it's from another MSP, it will replace it with yours.
  6. I have done this for many partners. I typically assign the grouping at the client level. Create a pull-down selection EDF for each of the Clients: Week 1/2/3/4; Patch Group 1/2/3/4/5; etc. The tab and pull-down selection will be created in Clients> Info> [Tab you create] Create an Search Advance Search (which will be used as Auto Join Search) "Patching - Group 1/2/3/4/5" In Patch Manager > Configuration > Groups: Create a new group for each of the Patching Groups while using the Auto-Join Searches that you created in the last step. Then assign your Microsoft / Third Party / Reboot Policies to each of the Groups. Since you've used the pull-down EDF, The assigned computers will not accidentally belong to multiple conflicting Groups.
  7. Braingears

    Ignite Tweaks

    I have been making updates to improve and calm tickets from some of the default Ignite monitors, and was looking for feedback. These changes are made directly to the monitors from MYSQL to make the change quick and easy. Everyone should have SQLyog already installed on your Automate/LabTech Server. # Change Internal - Disk Cleanup Monitors to 500Mb threshold Update agents SET DataIn='512000000' WHERE GUID="382b44ec-e51e-4a71-ab44-19517c0be288"; Update agents SET DataIn='512000000' WHERE GUID="af828887-5da0-4a9e-aefa-6ac4ced69ac3"; # Change Internal Event Log monitors - Reformat 'Identity Field' to more readable format UPDATE `Agents` SET IDField = "CONVERT(CONCAT(Eventlogs.TimeGen,' - ','Event ID: ',Eventlogs.EventID,' - ',Eventlogs.Logname,' Log - ', Eventlogs.Source,': ',Eventlogs.Message) using latin1) AS loggedEvent" WHERE GUID="1def1c67-91a1-44dd-b8f4-479781a4151a"; UPDATE `Agents` SET IDField = "CONVERT(CONCAT(Eventlogs.TimeGen,' - ','Event ID: ',Eventlogs.EventID,' - ',Eventlogs.Logname,' Log - ', Eventlogs.Source,': ',Eventlogs.Message) using latin1) AS loggedEvent" WHERE GUID="e2b83cbb-7feb-4be2-bfd4-d2ad8a095929"; UPDATE `Agents` SET IDField = "CONVERT(CONCAT(Eventlogs.TimeGen,' - ','Event ID: ',Eventlogs.EventID,' - ',Eventlogs.Logname,' Log - ', Eventlogs.Source,': ',Eventlogs.Message) using latin1) AS loggedEvent" WHERE GUID="2be5ef73-4e5a-4b63-9f26-11b4ee21577d"; UPDATE `Agents` SET IDField = "CONVERT(CONCAT(Eventlogs.TimeGen,' - ','Event ID: ',Eventlogs.EventID,' - ',Eventlogs.Logname,' Log - ', Eventlogs.Source,': ',Eventlogs.Message) using latin1) AS loggedEvent" WHERE GUID="42693737-1d00-4125-a5bf-5af26ad25639"; UPDATE `Agents` SET IDField = "CONVERT(CONCAT(Eventlogs.TimeGen,' - ','Event ID: ',Eventlogs.EventID,' - ',Eventlogs.Logname,' Log - ', Eventlogs.Source,': ',Eventlogs.Message) using latin1) AS loggedEvent" WHERE GUID="7560b975-13cc-4477-ba46-c8e8004b54e1"; UPDATE `Agents` SET IDField = "CONVERT(CONCAT(Eventlogs.TimeGen,' - ','Event ID: ',Eventlogs.EventID,' - ',Eventlogs.Logname,' Log - ', Eventlogs.Source,': ',Eventlogs.Message) using latin1) AS loggedEvent" WHERE GUID="94ccd545-90c7-4905-ad35-1fc2bce6dfb1"; UPDATE `Agents` SET IDField = "CONVERT(CONCAT(Eventlogs.TimeGen,' - ','Event ID: ',Eventlogs.EventID,' - ',Eventlogs.Logname,' Log - ', Eventlogs.Source,': ',Eventlogs.Message) using latin1) AS loggedEvent" WHERE GUID="5e94dcfc-4358-4072-a175-975c2ac22641"; UPDATE `Agents` SET IDField = "CONVERT(CONCAT(Eventlogs.TimeGen,' - ','Event ID: ',Eventlogs.EventID,' - ',Eventlogs.Logname,' Log - ', Eventlogs.Source,': ',Eventlogs.Message) using latin1) AS loggedEvent" WHERE GUID="710f056e-6c27-451c-80ee-039a83def7c2"; UPDATE `Agents` SET IDField = "CONVERT(CONCAT(Eventlogs.TimeGen,' - ','Event ID: ',Eventlogs.EventID,' - ',Eventlogs.Logname,' Log - ', Eventlogs.Source,': ',Eventlogs.Message) using latin1) AS loggedEvent" WHERE GUID="20ea384c-9ce9-439c-b9e2-e94286f52285"; UPDATE `Agents` SET IDField = "CONVERT(CONCAT(Eventlogs.TimeGen,' - ','Event ID: ',Eventlogs.EventID,' - ',Eventlogs.Logname,' Log - ', Eventlogs.Source,': ',Eventlogs.Message) using latin1) AS loggedEvent" WHERE GUID="17243be9-7c6b-4433-9680-4859d040eaf0"; UPDATE `Agents` SET IDField = "CONVERT(CONCAT(Eventlogs.TimeGen,' - ','Event ID: ',Eventlogs.EventID,' - ',Eventlogs.Logname,' Log - ', Eventlogs.Source,': ',Eventlogs.Message) using latin1) AS loggedEvent" WHERE GUID="3b2bb573-6e47-465d-b6bc-be053afa6f6b"; UPDATE `Agents` SET IDField = "CONVERT(CONCAT(Eventlogs.TimeGen,' - ','Event ID: ',Eventlogs.EventID,' - ',Eventlogs.Logname,' Log - ', Eventlogs.Source,': ',Eventlogs.Message) using latin1) AS loggedEvent" WHERE GUID="9ea836b9-966a-4139-8aec-bc6f47ba12aa"; UPDATE `Agents` SET IDField = "CONVERT(CONCAT(Eventlogs.TimeGen,' - ','Event ID: ',Eventlogs.EventID,' - ',Eventlogs.Logname,' Log - ', Eventlogs.Source,': ',Eventlogs.Message) using latin1) AS loggedEvent" WHERE GUID="d7b8675e-a3c6-497a-bd77-dff8939ffa02"; # Change Autofix Scripts FieldName -> VerboseFieldName UPDATE LT_Scripts SET ScriptData='H4sIAAAAAAAEAN2XS2/bMAyA7wX6H3jJZUCa+JXHEBh5FwGKrUCy7bKLYjO1VkUqJDnt/v3kRzonmL3CWNAlvlgkLYH8SIbKYBlI+qSnRBP/+gpgkMkqFYw4e9GSJNY5RRYqaO0N90SSLWqUBd0tE2vCCorssK/mIyq4bzltq+P1ul5n0Dq0HHx+G9PQb3sYrjuu03Q3QdC0LGw3iUt6Tddp9zsd9Nx10N2fkm5InW8Vvc+PW2p8eg1nFOjUk0ErX+X6ecxTeREmtoJUjNbyh0oTHavhoJUrimbbt3O9faB3/PlocTeb5kbnwOgeEfUK8ITUftvElLxz3URwTXmMif51nds+qzu6pemW/TK3LHiI3HieBGysRbGI7TepCnR2FTqnXwHvQ/LAPUOiEKa4oRxhhS8atIA1wheFIVAOKxo8ogYTnRKMhqmbsBESdEQVqNSxmz8n4IilcySfgLXtvhtsu13B2iqp0ImkmgaEwZiR4JFRpWG2M/4paMI3IjnlDwoID2EmpTCtnXBvBGL7FJtO56bhG0C00TBqNmXyd2gwEaQBpoqSHsjSOpFINC7j9Q8MdK2GsP51Q1j/W45WEcKGSpOasmyZtMQ8/AjXV8MdyrVQppnMr3OCf/gG/GMR/qzF3r549iMudISyFLyOTPk/E1U/A2K7NQfVwu9cPn7GSoteQUR2aC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uid='24f52f30-7061-11e1-a282-9632377fd7ba'; # Change Remote - Disk Transfers/Sec to 200 Update groupagents SET AlertMessage='%NAME% %STATUS% on %CLIENTNAME%\\%COMPUTERNAME% at %LOCATIONNAME% for %FIELDNAME% result %RESULT%.\n\nThis monitor measures each physical disk and if it goes above 200 disk I/Os per second then you\'ve got poor response time for your disk. A bottleneck from a disk can significantly impact response time for applications running on your system.|tzcompdisabled=1|priority=3!!!%NAME% %STATUS% on %CLIENTNAME%\\%COMPUTERNAME% at %LOCATIONNAME% for %FIELDNAME% result %RESULT%.\n\nThis monitor measures each physical disk and if it goes above 200 disk I/Os per second then you\'ve got poor response time for your disk. A bottleneck from a disk can significantly impact response time for applications running on your system.|tzcompdisabled=1|priority=3',DataIn='PMI:MwB8AC0AMQB8AEYAYQBsAHMAZQB8ADIAMAAwAHwAMAB8AC0AfAAwAA==' WHERE Name="Perf - Disk Transfers/Sec";
  8. Braingears

    Popup Message for workstations

    Function: If User Response You may also have a script performing what you are looking for hidden in 'Ticket Consolidation' called 'Monitor Prompt User to Reboot'. You can use copy/paste the lines that you are looking for.
  9. Braingears

    Automate Install - Rip & Replace - Powershell

    I found that older computers such as Windows 2003 Server did not download the files using the HTTPS links, but would work with HTTP; so I've revised the script accordingly. I've also added the capability to target the Location ID the computers are placed into.
  10. Braingears

    Automate Training

    http://connectwise.com/VirtualTraining Live training daily at 2:00pm EST and pre-recoreded training too.
  11. Braingears

    Reporting on expiration date of personal SSL certificates

    $threshold = 90 #Number of days to look for expiring certificates $deadline = (Get-Date).AddDays($threshold) #Set deadline date Dir Cert:\LocalMachine\My | foreach { If ($_.NotAfter -le $deadline) { $_ | Select Issuer, Subject, Thumbprint, NotAfter, @{Label="Expires In (Days)";Expression={($_.NotAfter - (Get-Date)).Days}} }} You can change the threshold to show only certificates that will expire within XX days and certificates that have already expired.
  12. Braingears

    Permissions

    https://docs.connectwise.com/ConnectWise_Automate/ConnectWise_Automate_Documentation/060/300
  13. Braingears

    Monitor AD Account Lockouts

    Monitor for Event 4740 https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4740
  14. Braingears

    Automate Install - Rip & Replace - Powershell

    Since you have to customize the script with your Automate server's FQDN and 'System Password', it cannot be called and run on demand from a public / generic source.
  15. This PowerShell script will automatically check if Automate is installed. It compares if the Automate server is yours, if not, download the Windows Agent Uninstaller, remove any existing instance of an existing Automate agent (from any MSP); then download the .MSI and reinstall the agent to your Automate server. Although it defaults to the 'New Computers' location, you can specify any Location ID to place the computers into. The script can be run manually on the client computer, from Control (aka ScreenConnect) Commands, or from Automate scripting using the Execute function (if you are performing a migration to another Automate server). If you want to force it to Rip & Replace, change $ForceRip = $True. Requirements: • Automate FQDN • Location ID #!ps #timeout=900000 #maxlength=9000000 $FQDN = 'YOURSERVER.hostedrmm.com' # Enter Automate Server FQDN Example: 'company.hostedrmm.com' $LocationID = '2' # Enter Location ID (Location ID '1' = New Computers) $SoftwarePath = "C:\Support\Automate" # Enter Software Path in order to download the files to Example: "C:\Support\Automate" $ForceRip = $False # Force Agent Uninstall / Install Example: $True or $False & {Start-Transcript -Path "$($env:windir)\Temp\AutomateLogon.txt" -Force $AutomateURL = "HTTPS://$($FQDN)" $AutomateSrvAddrReg = (Get-ItemProperty "HKLM:\SOFTWARE\LabTech\Service" -ErrorAction SilentlyContinue).'Server Address' $AutomateCompIDReg = (Get-ItemProperty "HKLM:\SOFTWARE\LabTech\Service" -ErrorAction SilentlyContinue).ID if (($AutomateSrvAddrReg -like "*$($FQDN)*") -and ($AutomateCompIDReg -ne $null) -and ($ForceRip -ne $True)) { Start-Service ltservice,ltsvcmon -PassThru Write-Host "" Write-Host "The Automate Agent is already installed." -ForegroundColor Green Write-Host "The Automate Agent is checking-in to: $($AutomateSrvAddrReg)" -ForegroundColor Green Write-Host "ComputerID: $($AutomateCompIDReg)" -ForegroundColor Green Write-Host " " } else { # Remove Existing Automate Agent if (Test-Path "$($env:windir)\ltsvc") { $DownloadPath = "https://s3.amazonaws.com/assets-cp/assets/Agent_Uninstall.exe" $Filename = [System.IO.Path]::GetFileName($DownloadPath) $SoftwareFullPath = "$($SoftwarePath)\$Filename" $wc = New-Object System.Net.WebClient if (!(Test-Path $SoftwarePath)) {md $SoftwarePath} Set-Location $SoftwarePath if ((Test-Path $SoftwareFullPath)) {Remove-Item $SoftwareFullPath} $wc.DownloadFile($DownloadPath, $SoftwareFullPath) Write-Host "Removing existing Automate Agent..." Stop-Process -Name "ltsvcmon","lttray","ltsvc","ltclient" -Force -PassThru -ErrorAction SilentlyContinue Stop-Service ltservice,ltsvcmon -Force -ErrorAction SilentlyContinue cmd /c $SoftwareFullPath Write-Host " " Write-Host "Waiting 60 seconds to continue..." -ForegroundColor Gray Start-Sleep 60 if (Test-Path "$($env:windir)\ltsvc\lterrors.txt") { Write-Host " still waiting..." -ForegroundColor Gray Start-Sleep 90} if (Test-Path "$($env:windir)\ltsvc\lterrors.txt") { Write-Host "$($env:windir)\LTSVC folder still exists" -ForegroundColor Red} else { Write-Host "The Automate Agent Removed Successfully" -ForegroundColor Green Write-Host " " }} # Install Automate Agent $DownloadPath2 = "$($AutomateURL)/Labtech/Deployment.aspx?Probe=1&installType=msi&MSILocations=$($LocationID)" $Filename2 = "AutomateAgent.msi" $SoftwareFullPath2 = "$SoftwarePath\$Filename2" if (!(Test-Path $SoftwarePath)) {md $SoftwarePath} Set-Location $SoftwarePath if ((test-path $SoftwareFullPath2)) {remove-item $SoftwareFullPath2} $wc = New-Object System.Net.WebClient $wc.DownloadFile($DownloadPath2, $SoftwareFullPath2) Write-Host "Installing Automate Agent on $($AutomateURL)" -ForegroundColor Yellow msiexec.exe /i $($SoftwareFullPath2) /quiet /norestart LOCATION=$($LocationID) Write-Host "Waiting 3 minutes for Automate to install..." -ForegroundColor Gray Start-Sleep -s 180 Write-Host "Starting Automate Services..." -ForegroundColor Yellow Start-Service ltservice,ltsvcmon -PassThru $AutomateSrvAddrReg = (Get-ItemProperty "HKLM:\SOFTWARE\LabTech\Service" -ErrorAction SilentlyContinue).'Server Address' $AutomateCompIDReg = (Get-ItemProperty "HKLM:\SOFTWARE\LabTech\Service" -ErrorAction SilentlyContinue).ID if (($AutomateSrvAddrReg -like "*$($FQDN)*") -and ($AutomateCompIDReg -ne $null)) { Write-Host " " Write-Host "The Automate Agent is checking-in to:" -ForegroundColor Green Write-Host "$($AutomateSrvAddrReg)" -ForegroundColor Green Write-Host "ComputerID: $($AutomateCompIDReg)" -ForegroundColor Green Write-Host " " } else { Write-Host " " Write-Host "The Automate Agent is NOT installed and/or checking-in" -ForegroundColor Red Write-Host "Server Address: $($AutomateSrvAddrReg)" -ForegroundColor Yellow Write-Host "ComputerID: $($AutomateCompIDReg)" -ForegroundColor Yellow Write-Host " " }} Stop-Transcript } 2019-04-11 - Replaced newer uninstaller | Save Transcript to C:\Windows\Temp
×