N-able RMM: Community Scripts - Page Twenty-Two

Last Modified

Tue Jan 29 14:16 GMT 2019

Description

Disclaimer: Please note, if any items or other contains set forth herein is derived from N-able, any items or other content posted are provided as a suggestion or recommendation to you for your internal use. This is not part of the N-able software or services that you have purchased from N-able, and the information set forth herein may come from third party customers. Your organization should internally review and assess to what extent, if any, such custom items or recommendations will be incorporated into your environment. Any custom scripts obtained herein are provided to you "AS IS" without indemnification, support, or warranty of any kind, express or implied. You elect to utilize the custom scripts at your own risk, and you will be solely responsible for the incorporation of the same, if any.

Environment

  • N-able Remote Monitoring & Management (RMM)

Solution


Fix It Script List
 
DownloadProblem title: Looking for a Script to determine Computers Hardware 
Problem description: I've found many scripts that find the processor, or the amount of RAM a computer has, but I'm looking for a script that could find all the hardware information. It could either pull the data from the "Hardware" tab of RMM, or a script that will find the information, and put it into a text file. 
Fix description: Uses WMIC from DOS Batch file to pull whatever informaiton is available from the system (varies depending on the capabilities of the individual hardware, etc.) and dumps it into a text file on the C: drive. There is a lot of information that may or may not be of value. You may be better off just using a 3rd party PC auditing tool. Can be run from RMM. Success w/ Windows XP systems is not guaranteed.
DownloadProblem title: Configure Windows Update to not download 
Problem description: I am looking for a script to prevent Windows Update from downloading updates. I need to ensure that the Windows Update service is still running though as I use Patch Management on the MAX RMM. All scripts welcome! 
Fix description: Script found at http://fixitscripts.com/problems/windows-update-settings VBScript which allows values to be passed through at "Command Line" in RMM Automated Tasks -- acceptable values are: 1 = "Never check for updates" 2 = "Check for updates but let me choose whether to download and install them" 3 = "Download updates but let me choose whether to install them" 4 = "Install updates automatically" otherwise it will return an error message. Tested on Windows 8.1 and works.
DownloadProblem title: this is another test 
Problem description: this is just a test, please ignore it 
Fix description: This is a fix! I need to make this 30 characters!
DownloadProblem title: Clean Up Recycle Bin 
Problem description: Is there a script that will clean up recycle bin ? 
Fix description: PowerShell Script to empty Recycle Bin
DownloadProblem title: Script check Time Machine Backups and report how long since last good backup on Client Daily Report 
Problem description: There is not a built-in way to check Time Machine backups in the OSX Agent version 1.0. A script is needed to do this. I was going to post my script, but I do not have enough points, so I will try back tomorrow. 
Fix description: This is a bash shell script. The OS X 10.9 (Mavericks) upgrade broke the old ways to check for the last backup time. This script will run the appropriate command for the version it is run on. Supports OS X 10.6-10.10. Put the max number of minutes without a backup to fail on the command line. 1440 minutes = 1 day. On 10.9 a file /Library/Preferences/com.RMM.MaxRMM.TimeMachine will be created to store the last backup date. That way, if the backup drive is unplugged or unavailable, the check will not fail as long as the last backup stored there is within the parameters.
DownloadProblem title: Postfix MTA Queue Length Check 
Problem description: Hello, The MAX RMM dashboard has the option of a, once a day, check (Daily Safety Check) of the Postfix MTA queue size on a Linux (CentOS) server. This same check is not available as a 24x7 check, for some reason. I need to be able to check the MTA queue size throughout the day to detect issues. Can anyone offer any suggestions or scripts, that would be compatible with MAX RMM, that would alert if the Postfix queue was larger than a defined threshold, or the typical average size? Best Regards, Bob 
Fix description: Hi Linux-Lovers, this is my one-liner-script to check the postfix queue size on a regular schedule. It is working on Ubuntu, but will probably work on other linux flavours too. Save the script to `/usr/sbin/postqsize`. That way, you can check that the script is working by typing `postqsize` on the command line. It will take the alert value as the parameter. Omitting a parameter will lead to never ring the alarm bell. Everything is documented, so please have a look at the small source code. In RMM create a new user script and give it a speaking name, eg. "Postfix Queue Length". Adjust the OS to linux and type to "Script Check". Than add the 247-Check to your linux server and make RMM a bit more usefull on linux. Please report any issues here and I will assist in finding a solution. Greatings from Germany. Michael
DownloadProblem title: Crashplan backup 
Problem description: I need a script that will check the log files of my backup application, Crashplan Pro The log files include a line that indicates the last time a backup has completed. I am also open to other ways to integrate RMM with crashplan 
Fix description: Takes original script, adds adds "brand"'s 24hr fix, and fixes the date-check to handle computers set to use ANSI ISO 8601 dates (YYYY-MM-DD)
DownloadProblem title: RMM - Get expired AD Passwords 
Problem description: I wrote a powershell script for RMM Dashboard that outputs all users with expired AD passwords. My Problem is that the script works well in the powershell console and inside ISE, but over RMM Dashboard I get no output from the script. My PowerShell Script: $today = Get-Date Import-Module ActiveDirectory $Expired = Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} -Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} | Where { $_.ExpiryDate -lt $today } if($Expired) { Write-Host "Folgende Benutzer haben abgelaufene Kennwoerter:" Write-Host "" ForEach($acc in $Expired) { [string]$name = $acc.DisplayName [string]$date = $acc.ExpiryDate Write-Host "$date :: $name" } Exit 1001 } else { Write-Host "Keine abgelaufenen Kennwoerter" Exit 0 } Hope anyone can help my fix this script! ;) 
Fix description: RMM did not support splitted commands
DownloadProblem title: Script to check when a certificate is about to expire 
Problem description: There are few scripts on here that i am trying to figure out to work to check for certificates about to expire, i want to be able to run a task on RMM to check for certs that are about to expire. Either to run on servers or on workstations. Is it possible to check the entire cert store? This is the script is tried fromt FitITScripts Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin -ErrorAction SilentlyContinue Add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue $DaysToExpiration = 31 $expirationDate = (Get-Date).AddDays($DaysToExpiration) [array]$exchCerts = Get-ExchangeCertificate | Where {$_.Services -match "IIS" -and $_.NotAfter -lt $expirationDate} $intExit = 0 if ($exchCerts.Count -gt 0) { Write-Host "Exchange SSL Certificate Expiring in less than 31 days" $exchCerts | fl CertificateDomains, IsSelfSigned, Issuer, NotAfter, RootCAType, Subject, Thumbprint $intExit = 1001 } else { Write-Host "No Exchange SSL Certificates expiring within 31 days" } exit $intExit **But i get this error** The term 'Get-ExchangeCertificate' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct an d try again. At C:\Users\Admin\Desktop\Untitled1.ps1:19 char:44 + [array]$exchCerts = Get-ExchangeCertificate <<<< | Where {$_.Services -match "IIS" -and $_.NotAfter -lt $expirationDate} + CategoryInfo : ObjectNotFound: (Get-ExchangeCertificate:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException I also tried the other one that saves to a file called list.txt, but just give error as the text output from the script Any help would be greatly appeciated 
Fix description: Try if this fix your Problem: Exchange 2003 (try) Add-PSSnapIn Microsoft.Exchange* Exchange 2007 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin Exchange 2010 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 Exchange 2013 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2013 There were missing underline at $_.xxxxxxxx
DownloadProblem title: Need a script check to tail a log file 
Problem description: Hi there... I need a script that will tail a log file and save the last dozen or so lines to the output of the check. Here is my scenario: Nightly robocopy script replicates a folder to another folder. The resulting loRMMle looks like the below. I would like to grab the end of the log file similar to the *nix command 'tail' and include that in the check notes. Note in the example log below that I really need to see is **in bold text**. ------------------------------------------------------------------------------- ROBOCOPY :: Robust File Copy for Windows **Started : Thu Jan 08 17:06:48 2015** **Source : C:\temp\** **Dest : C:\temp2\** Files : *.* Options : *.* /NDL /NFL /COPY:DAT /R:1000000 /W:30 ------------------------------------------------------------------------------ **-any errors will be right here-** ------------------------------------------------------------------------------ **Total Copied Skipped Mismatch FAILED Extras** **Dirs : 1 0 1 0 0 0** **Files : 5 0 5 0 0 0** **Bytes : 6.91 m 0 6.91 m 0 0 0** **Times : 0:00:00 0:00:00 0:00:00 0:00:00** **Ended : Thu Jan 08 17:06:48 2015** 
Fix description: This should get what you need, however it will always return the last 10 lines of the file. You could easily expand on this and have the check fail only if the log had errors. If you need more help with it and could send me a full log of when it fails and one when it passes I can help you out more.
DownloadProblem title: Script that checks the date of a file 
Problem description: I need a script that will check the date of a specific file and fail a Daily Safety Check in Max if the File is over X days old. 
Fix description: **VBScript that parses User defined folder for a User defined file, reporting a failure to MAX Remote Management if the file is older than amount of Days specified by User** *This script requires Three Command Line Options* *First Command Line: Directory to Parse for File *Second Command Line: Name of File for review *Third Command Line: Older than Day Variable for check *Confirmed working in a Windows 7 (x64) platform* ***Example Usage:*** "C:\Test" "test.txt" 5
DownloadProblem title: Exchange mailbox size 
Problem description: Is it possible to find the mailbox size of all users in an exchange environment? 
Fix description: Lists a defined number of the biggest mailboxes in exchange (example is 30) Change to suit your needs. Results displayed in the shell.
DownloadProblem title: User Notification 
Problem description: I would like a Script that can provide a Customized System Message to Logged on User(s). 
Fix description: **VBScript that allows for a Customized System Message to be sent to Currently Logged on User(s)** *Confirmed working in a XP (x86), 2003 (x86), Windows 7 (x64), Server 2008 R2 platform* ***REQUIREMENTS of SCRIPT:*** -ONE Command Line Variable ***1st Variable*** - Admin defined Message Example: "MESSAGE FROM YOUR IT PROVIDER: Patch Management routine will begin at 7p EST Tonight. Reboot(s) may occur during the Patch Management cycle."
DownloadProblem title: Script to detect more than one process of dllhost.exe running on a workstation 
Problem description: Looking for a script to detect multiple processes of dllhost.exe running on the workstation. And fail check in RMM dashboard. Any help would be appreciated. 
Fix description: Detects 6 or more instances of dllhost.exe. Useful for detecting poweliks malware. Change the number from 6 to whatever suits your needs. bluefish
DownloadProblem title: Get the local time from a computer in my network? 
Problem description: It seems simple but my network has computers all over the world and it would be really neat if I had a script that could tell me the time of a computer I was working on remotely. 
Fix description: This script will get the time on a local computer. This script will run in MAX RemoteManagement.
DownloadProblem title: SIP Trunk Monitoring/Alert 
Problem description: I'm looking for a script to add to our RMM Dashboard that will ping the status of our VOIP SIP trunk automatically. Currently I'm connecting to the VOIP switch via SSH and manually running "sh sip-ua register status" and verifying that the registered status is "yes". 
Fix description: Step 1. Download plink.exe (optional)Step 2. Setup SSH keys between the windows machine and the pbx. Step 3. Have the script run on some sort of timer You can do a lot more if you wanted. For example. Save the output to a variable. If $var -ne "yes" then have plink issue a service restart or have powershell email you.... etc
DownloadProblem title: Automated program install via remote command line 
Problem description: Hi Guys, So basically what I'm trying to setup is an automated MSI installed that has to be working via RMM remote command line. I'm not really a good programmer so I have no clue how to combine all the options that I would like to use. I want to do the following steps. 1) (completed) download the MSI file remotely to the computer bitsadmin /Transfer Job http://XXXX/software/test.msi c:\temp\temp.msi 2) The file then remains as a .tmp file until the bitsadmin /complete command is provided. Due to conflicts when running the transfer file multiple times it's important that the script is able to pulll both the GUID and status from bitsadmin /list As soon as the status is "Transferred" the command bitsadmin /complete GUID should be executed. 3) Installing the file on the background by using: msiexec /i http://www.xxxx.nl/test.msi /quiet /qn /norestart /log c:\log\logGUID.log Would someone be able to help me out to get this starting up? Directly downloading and installing the file using msiexec isn't really an option because it's not really failsafe, it does however work for smaller files, but with 50mb+ it's not really happy with it. Thanks for your time. 
Fix description: Hopefully BITS isn't mandatory because I'm not a fan. I would do the following in powershell.
DownloadProblem title: hard disk bad blocks check/script 
Problem description: I need a check that will flag up a hard disk bad blocks error in the event log. it's not simply a error ID check, as it has to flag up only the Hard disk0 (because this is the main disk) Thank you 
Fix description: The following script combs the event logs for disk errors, and flags the dashboard accordingly. Using this script as a check tends to be more sensitive than smart detection. Given that a lot of disks record errors now and again, we tend to clear the event log and ignore errors we deem to be minor or one off issues. If errors re-occur, or become more frequent we tend to schedule a call with the customer.
DownloadProblem title: Script to check local Document storage 
Problem description: I am trying to make a script that will identify if users are saving files on their local PCs. For simplicity to achieve this I would like to find out if the size of the C:\Users\%username%\Documents and the C:\Users\%username%\Desktop folders are larger than 10Mb. So far I have come up with using power shell as my weapon of choice (only because I don't really know any better and I am open to suggestions). I have got this so far: *$colItems = (Get-ChildItem C:\users\$env:UserName\desktop -recurse | Measure-Object -property length -sum) If (($colItems.sum / 1MB) -gt 10) { Write-Host "Desktop Items"} Else{ $colItems = (Get-ChildItem C:\users\$env:UserName\documents -recurse | Measure-Object -property length -sum) "{0:N2}" -f ($colItems.sum / 1MB) + " MB" If (($colItems.sum / 1MB) -gt 10) { Write-Host "Document Items"} Else{ Write-Host "Pass"} }* Any assistance would be great. Im looking at running this as a RMM script to alert a site contact to users saving documents to the local PCs. 
Fix description: So after some fiddling and a little work I have created this little script. It could provide more information on where the files are but it does what I need it to. It checks the currently logged on users desktop size and if this is larger than 10MB the check fails, and it reports the user name and the size of their desktop. If the users desktop is not larger than 10MB it reports the desktop size and then checks to see if the users documents folder is bigger than 10MB. if this is true the check fails and it reports the sizes of both folders and the currently logged in user name. If both folders are less than 10mb it reports the size of both folders, the check passes and it reports "pass"
DownloadProblem title: PING check for Mac-only environments? 
Problem description: Hello! We have quite a few clients with nothing but macs. It would be nice to be able to set up ping-checks. Any idea how this could be done? Is AppleScript the way to go? 
Fix description: Hi, this is a simple bash script for MAC. As argument give the ip-address or the DNS-Name from the server. regards, Raimund
DownloadProblem title: How to determine what user is logged on to windows? 
Problem description: Hello everyone, I am in need of a way to determine what user is logged on to windows? I am using RMM. Thank you 
Fix description: This is written in PowerShell V3 and may not work properly in earlier versions. The below script is designed to accept custom parameter input. This allows you to type a single computer name as a string or pipe a list of computers to the function and it will process each. The benefit of using this as opposed to the other script posted is that the other script is using a foreach loop. This runs as a serial command meaning that if one of the computers you enter is offline the script will hang while waiting to timeout. This script however pipes all computer names to the function and runs them all simultaneously (in parallel) If one computer times out the others will continue to process. I also included an option for a switch "-Gridview". If you run the command with this switch the output will be displayed in a dialog box instead of returned to the console window. this is especially useful for a large number of computers. Use the below syntax to run the script: Get-Content C:\computerlist.txt | Get-ComputerUser (List of computers in a text file) or 'hostname','hostname','hostname' | Get-ComputerUser (A handful of computers) or Get-ComputerUser -ComputerName 'hostname' (A single computer)
DownloadProblem title: Backup Power Notification Scripts? 
Problem description: I am looking for a script to use to notify via SMS and Email when a server switches to battery backup due to a power outage. This would be handy to make sure the servers get a clean shutdown before the battery backup runs out or fails. 
Fix description: Looking for the same thing, I was able to put this batch script together in a few minutes, based on an existing idea from Rob van der Woude. It uses WMI to poll battery status. This guy has also made a script that calculates battery health. I'll look into that later. In Remote Management, this script fails the check if battery status is not 2, making it useful for server monitoring etc. I made it myself when APC PowerChute Business didn't find the USB attached battery at one of our clients. This is way better than having to receive email alerts. :) Good luck! ___ - Bjørn Mathisen, CAP10 AS - Oslo / Norway
DownloadProblem title: Script to run basic command line commands 
Problem description: Hello, We have a technician version of MalwareBytes that we can have installed on only one machine at a time. We need to create a script that will run the following commands: c:\nds\apps\mbam\mbam-tech.exe /silent /NORESTART *****then there needs to be some delay...I'd say at least 5 minutes C:\Program Files (x86)\Malwarebytes' Anti-Malware (tech)\mbam-tech.exe /runupdate ****again, I'd say at least a 5 minute delay C:\Program Files (x86)\Malwarebytes' Anti-Malware (tech)\mbam-tech.exe /fullauto ****This will take quite a bit of time....not sure how long to make a delay here. If there is a way for the script to determine if the above command has finished running before running the next command that might be really good...if not possible, I'd say a 3 hour delay. C:\Program Files (x86)\Malwarebytes' Anti-Malware (tech)\unins000.exe /verysilent /suppressmsgboxes /norestart Any help? 
Fix description: commandline1 && commandline2 && commandline3 the && says If commandline1 succeeded, run2, then 3 etc see http://www.robvanderwoude.com/condexec.php

In addition to the Community Scripts, review the N-able Automation Cookbooks to leverage automation policies, custom monitoring, and scripts to gain more efficiency in your business.