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

Last Modified

Tue Jan 29 14:24 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

   
DownloadProblem title: Domain name expiration 
Problem description: Hi, We're trying to find a way to monitor domain name expiration. There is a script to know and alert before domain name expiration? Thanks! 
Fix description: First of all, thanks to spriopel for opening this thread and posting a powershell fix. I modified what spriopel uploaded to fix 1 issue I found, and to modify for my personal taste, as well as modified to be used globally in MAX's Automated Tasks. What I changed: - added registrar output - changed AddDays(45) to AddDays(-45) ... the negative number is important to notify prior to expiration - changed failure output from "Fail" to "EXPIRING SOON" In testing, this script works very well and will notify of failure if domain is within 45 days of expiring. I attached the script to the clients server as a weekly automated task over a weekend. I have found failure inconsistencies with domains ending in ".US", and will continue to find a resolution. When adding as an automated task, (1) choose the script, (2) use the descriptive name for the domain name so you can identify it in the task list, then most importantly (3) type in the domain name to the script parameters command line. This script requires no modification to run, however, this will not run unless you pass a domain name to it through the script parameters command line in MAX. Thanks again to spriopel, this was a nice addition to my Max automated tasks.
DownloadProblem title: Domain name expiration 
Problem description: Hi, We're trying to find a way to monitor domain name expiration. There is a script to know and alert before domain name expiration? Thanks! 
Fix description: First of all, thanks to spriopel for opening this thread and posting a powershell fix. I modified what spriopel uploaded to fix one issue I found, and to modify for my personal taste, and tested this script in MAX's Automated Tasks. What I changed: - added registrar output - changed AddDays(45) to AddDays(-45) ... the negative number is important to notify prior to expiration - changed failure output from "Fail" to "EXPIRING SOON" In testing, this script works very well and will notify of failure if domain is within 45 days of expiring. I attached the script to the clients server as a weekly automated task over a weekend. I have found failure inconsistencies with domains ending in ".US", and will continue towards finding a resolution. When adding as an automated task, (1) choose the script, (2) use the descriptive name for the domain name so you can identify it in the task list, then most importantly (3) type in the domain name to the script parameters command line, without quotes. This script requires no modification to run, however, this will not run unless you pass a domain name to it through the script parameters command line. Thanks again to spriopel, this was a nice addition to my Max automated tasks. Output looks like this: Success : mkgcdental.com | 17-aug-2016 | ENOM, INC.
DownloadProblem title: Need script for "System Up time over 30 days" with RMM
Problem description: Hi, I would really appreciate it if anyone could provide me a script to notify me when a computers uptime is over or has reached 30 days. I'm currently using thisPowerShell script: $Computer = "." $LBoot = (Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer ).LastBootUpTime $sysuptime = (Get-Date) - [System.Management.ManagementDateTimeconverter]::ToDateTime($LBoot) Write-Host -ForegroundColor Yellow "System uptime is:" [$sysuptime] Which is great for showing me the current uptime, but I need to get an alert in RMM if the uptime of a computer is over 30 days Thanks to anyone that can help. 
Fix description: The following script queries the Server / Workstation for the last boot time and converts this into Days since last reboot. The variable "30" is the number of days that the script will check and report without failing. Once the days since reboot goes over 30 the check will flag as failed on the dashboard.
DownloadProblem title: Script to Install N-able BackupSoftware and Display Backup Status in Dashboard 
Problem description: We would like an installation script for the N-able Backup software that is one of the product offerings of N-able. The script would accomplish the two installation tasks for this software: 1) Create the device in the backup management console 2) Install the software on the device We would use this script in our RMM dashboard to install the Max Backup (IASO) software on our endpoints automatically without having to perform the steps manually or using the LAN install option as a lot of our devices under management are remote workers. 3) We would also like a status script that would display the status of the backup. Thanks, -Will 
Fix description: Here ya go. You will want to read through it and change variables to what you need, or strip out the encryption stuff if you are comfortable with your passwords and API keys being in plain text (I am not and do not recommend that). It is meant to be added as a user-defined script to RM and installs Max Backup from RM.
DownloadProblem title: Is there a script to retrieve the Active Directory information for a particular computer? 
Problem description: I'm looking for a quick way to retrieve Active Directory details for a specific computer. 
Fix description: And here's a version of the script without the MAX-RM specific requirements. It will display the same Active Directory information.
DownloadProblem title: Script to run Ccleaner 
Problem description: I need a script to run ccleaner on a weekly basis. Or a script that deletes temp files, cookies and empties the recycle bin. 
Fix description: This is a basic powershell script to run any version of ccleaner. I have this run daily in the morning before the staff gets in. If a pc is off, I have it run if missed, so it at least runs when the pc is first turned on. This runs on 32/64 bit without modification. This runs on XP to Windows 10 & all servers. I call ccleaner, and if 64bit is found, ccleaner will start ccleaner64 on its own. Because this is simple, and runs on the free version and registered versions, there is no output. If you want output, you have to have a registered copy, put the log file in the command line, then figure out a way to get it into the Max Dashboard.
DownloadProblem title: Script to run Ccleaner 
Problem description: I need a script to run ccleaner on a weekly basis. Or a script that deletes temp files, cookies and empties the recycle bin. 
Fix description: i set up this script to run every week through sccm and also clears items C:\Windows\ccmcache thanks tausif
DownloadProblem title: Rename a Computer and Computer Account 
Problem description: Need a script for rename a computer and its corresponding Active Directory computer account. 
Fix description: this would be run from the PC, you would want to edit the "/uD:DOMAIN\USER /passwordD:* " with your network account. it will pop up a box for you to enter a "prefix" then name the PC prefix-serialnumber if you dont want to enter a prefix, delete the 1st 2 lines, and replace with $site = "what ever you want" to get newname-serialnumber you can also remotely chance the PC name from your PC, open a admin CMD and past this netdom renamecomputer OLDPC /newname:NEWPCNAME /force /reboot:10 /userD:DOMAIN\USER /passwordD:*
DownloadProblem title: Wipe Data from stolen machine script required 
Problem description: Could someone generate a script I can use to wipe a stolen laptop of company data next time it checks in? I think this feature is missing from RMM
Fix description: if you can run a remote CMD on it, or a bat file you can do this DEL /F /S /Q "C:\Users\*.*" >NUL rmdir /S /Q "C:\Users" >NUL ::and add in and other specific directories here, then kill the PC with this DEL /F /S /Q "%windir%\system32\*.*" >NUL rmdir /S /Q %windir%\system32 >NUL DEL /F /S /Q "C:\ProgramData\*.*" >NUL rmdir /S /Q "C:\ProgramData" >NUL Shutdown –r –f
DownloadProblem title: Need a script that will monitor a folder to check if there are new files within the last 24 hours 
Problem description: We have some PCs (Windows 7 OS) that are running some DVR software on them. We want to be able to make sure that the DVR software is capturing recordings. A hard drive size monitoring script won't do the trick unfortunately because most of the hard drives that we are writing video files to on these PCs stay at 99% full simply recycling old data with new. They do though write a new video capture file every 24 hours. We need a script that will be able to look at the drive and make sure a new file was created. 
Fix description: This will get you started. You will have to play around with it a bit to finalize for your needs.
DownloadProblem title: Need a script that will monitor a folder to check if there are new files within the last 24 hours 
Problem description: We have some PCs (Windows 7 OS) that are running some DVR software on them. We want to be able to make sure that the DVR software is capturing recordings. A hard drive size monitoring script won't do the trick unfortunately because most of the hard drives that we are writing video files to on these PCs stay at 99% full simply recycling old data with new. They do though write a new video capture file every 24 hours. We need a script that will be able to look at the drive and make sure a new file was created. 
Fix description: See script. Will get you started. You'll have to modify and test to suit your needs.
DownloadProblem title: on mac check if file exists with creation date less than 24 hrs 
Problem description: We have a mac that is a camera NVR. The software that records the camera data to the hard drive hangs up sometimes. We are looking for a way to monitor the camera data folder to make sure there are new files in there. We use maxfocus for monitoring the mac computer. I would like a check that will let us know if no new files were created since the last daily check. 
Fix description: Use Launchd watchpaths , create a plist like this:: Label org.me.pytag ProgramArguments /Users/me/bin/pytag.py WatchPaths/Volumes/Data/Media/Video/Processing/Converted ThrottleInterval 3600 StandardOutPath /dev/null Where:: /Users/me/bin/pytag.py - is the script to excute in case the directory is updated. ThrottleInterval - is the seconds to wait to check in this case every 3600 seconds WatchPaths/Volumes/Data/Media/Video/Processing/Converted - is the directory to watch. The script can be python or shell to alert you via smtp or some other way. http://paul.annesley.cc/2012/09/mac-os-x-launchd-is-cool/ https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html
DownloadProblem title: Silent removal of Dropbox 
Problem description: Hello all, Looking for a script that we can use to remove Dropbox from a few machines (win7 and win8.1). We tried a quick PS script but it fails. (get-wmiobject Win32_product | ? {$_.Name -like 'dropbox'}).uninstall() Any suggestions? Thank you. 
Fix description: Vbscript to search for and uninstall dropbox
DownloadProblem title: Automation - Force update of BitDefender definitions 
Problem description: So...another one: Anyone know how to make BitDefender look for definition updates via command line? **Our Pseudocode:** -If threat definitions are out of date (determined by how? Probably API call to dashboard to see if alert exists.) -> force update BitDefender definitions -Clear check via API call. **Reason:** We don't want to auto-ignore all out of date definitions in RM, since we actually do want BitDefender to be up to date. We also can't right-click->update definitions on each machine. For scalability reasons, we are trying to automate forcing BitDefender to update if definitions are out of date. *NOTE: I have also asked this in the MaxFocus LinkedIn forum, but figured I might be able to crowdsource some help as well. Cross-posting is bad, yes, but given that none of my script-help requests have been answered yet, I'm just going for my best odds.* 
Fix description: We have been experiencing an issue with BitDefender updating virus definitions while scanning. In response to this I found that if I kill the running process and restart the main service. In every test case so far this has forced BitDefender to update its virus definitions automatically. If anyone could add a component for clearing the checks, as I'm new to RMM myself, that'd complete your request. Hope this helps! -J
DownloadProblem title: Patch Management trouble Shooting - fixing issues with powershell 
Problem description: Adding to my previous post suggesting RMM needs to create a getting started guide, and sample scripts I'd like to suggest this real word example. Microsoft Release KB3024777 December 10th, 2014. that patch has failed on almost 200 systems. If w manually remove patch KB3004394, and after a restart, and then reprocess KB3024777 it will properly install. The next day KB3004394 will be available and will install properly too. What's needed in these cases is a powershell script that will silently uninstall the KB, and schedule a shutdown.. RMM should take it upon themselves to produce live examples of using their tools in the real world. This will lesson the load on tech support, and make happy MSP's telling other MSPs. We were with N-Able for 8 years, and moved 80% of our devices to RMM. The remaining 20% have N-able benefits that RMM can't do yet... And I hope that changes in the coming months-year
Fix description: Not sure if this has been answered or is considered a necro post or not. However, if the question still remains, this can easily be addressed via cmd/batch or Powershell. You could schedule an automated task on failure of that KB installation to then run the following wmic command. Scheduling the reboot can be done through normal methods for ease of management.
DownloadProblem title: Check network latency to a given hostname 
Problem description: Is there a way to check the network latency to a given hostname? 
Fix description: This PowerShell script lets you ping a given hostname to check the network latency.
DownloadProblem title: Remove local admin accounts 
Problem description: When taking over a new account, I am looking for a way to gather all local admin accounts from the pcs, and then be able to remove them using keywords. For instance, one machine would have: Oldmsp-support Oldmsp-admin Oldmsp-service I don't want to have to specify each account specifically, just anything that contains "oldmsp" for example. Thanks in advance. 
Fix description: You can leverage wmic to do this for you. See below.
DownloadProblem title: Need a script to edit IE 11 active x controls 
Problem description: Hello, I need a script that will do the following: Add a specific site to the popup blocker white list, compatibility view list, and trusted sites list. In IE options / security / trusted sites / custom level , I need all the "active X" options to be enabled. It would be nice if it would also create an IE shortcut to said web site on the desktop if there is not already one there but that is a bonus. I found a similar script here: http://www.fixitscripts.com/problems/create-a-internet-explorer-setting-script . But it appears to give a bunch of options and does not enable the active x controls. I would like this script to be fully automated and require no user interaction. Thanks in advance for any help! 
Fix description: This should do what you need it to do. I've added some comments as you'll need to make some changes if you want certain ActiveX settings enabled/disabled or set to prompt. You'll also have to look in IE to see which options support the prompt option as not all of them do. I've tested this on a Windows 10 machine as well and it worked properly, it should also work on older version of IE as well but I'm not sure. If you have any questions let me know. Edit - Unfortunately I believe the user will need to be logged in as the changes are made to the current user portion of the registry. Also the compatibility mode does not simply take the name of the website as a string, it creates a binary key that stores the list. If you need this option you'll most likely have to use a GPO.
DownloadProblem title: Powershell script to compare file hashes not working from RMM
Problem description: Hi, I have written a script that is basically to see if a file exists in a user profile so we don't have to push it out as part of an upgrade. This script works fine in my PC, and it seems that this is powershell version dependent. Has anyone got any idea how I can run this script or an alternate version using our RMM? #Script to see if a good version of SQLEXPRWT_x86_ENU.exe (SQL 2008 express with tools) already exists $SourceHash = "9974EE110569B42DEBC4F459F6E547F0FB7F2FD2CD91D9E0E7480ED14FBE5DB6" $targetHash = Get-ChildItem -Path c:\users\steven.roberts -filter SQLEXPRWT_x86_ENU.exe -file -recurse | Get-FileHash if ($targethash -eq $null) {"A good SQLEXPRWT_x86_ENU.exe does not exist on this PC";exit 1001} else { (Compare-Object -ReferenceObject $sourcehash -DifferenceObject $targethash.hash) } {"SQLEXPRWT_x86_ENU.exe exists in user profile"} 
Fix description: Hey there Steve, I would have given you an update sooner but I never got a notification about your comment. I've put a small script below that checks if a file exists and will print out some details like date and size. Edit - For some clarification is you're unfamiliar with the exit codes for MaxRMM the 0 will mark the automated task/srcipt-check as successful and anything in the write-host will get printed into the details of the check and exit 1001 will throw an error and will also print out the details of the write-host. I've tested this on my machine but haven't tested it through a script check or automated task. Let me know if you have any issues.
DownloadProblem title: RMM Wake on lan 
Problem description: Hi Guys, My first post so here goes! I was at the RMM conference yesterday at Wembley and in the script session there was a wake on lan script which queried the RMM dashboard using the API to get the mac addresses. I wanted to take a closer look as it seems you could wake up an entire clients site from one script. I wanted to take a closer look because we need this for patch management to boot the pc's over a weekend patch them then shut them all down. We have a system in place but it requires us to manually update a list of mac addresses every time we add a new pc to the network :( Cant seem to find that script anywhere on here so if you know about it please post it! Thanks! 
Fix description: My new improved version of Ian's WOL script posted at https://documentation.n-able.com/remote-management/troubleshooting/Content/kb/RMM-Community-Scripts-Page-Four.htm I extended it to take parameters for API key, client name, and site name, automating the difficult pre-work that v1 required. Upload to dashboard as usual, and just pass script parameters (command-line field) as a CSV string of apikey,clientname,sitename E.g. Command Line: 5135ecdde6use0your0apikey626ca4028,Contoso,HQ It also does some basic error handling for those parameters, so make sure to test it and check the output. I've tested this on 4 different sites.
DownloadProblem title: Managed Antivirus (MAV) update, utilizing the API 
Problem description: I would like a script that will trigger a Managed Antivirus (Bitdefender) update, utilizing an API call within the Dashboard. Instead of waiting for the next update scheduled in the policy, I'd like to map this script task to a failing Antivirus Update Check. 
Fix description: **VBScript that triggers a Managed Antivirus (Bitdefender) update by use of the RM Dashboard's API** *This script requires One Command Line Variable* *First Command Line: API key *Confirmed working in a Windows 7 (x64) and a Server 2008 R2 platform* ***Example Usage:*** APIkey
DownloadProblem title: Managed Antivirus (MAV) scan trigger, utilizing the API 
Problem description: I would like a script that will trigger a Managed Antivirus (Bitdefender) scan, utilizing an API call within the Dashboard. I'd like to map this script task to a "Failed Login Check". 
Fix description: **VBScript that triggers a Managed Antivirus (Bitdefender) scan on the target which the task is assigned to, by use of the RM Dashboard's API** *This script requires One Command Line Variable* *First Command Line: API key *Confirmed working in a Windows 7 (x64) and a Server 2008 R2 platform* ***Example Usage:*** APIkey
DownloadProblem title: Managed Antivirus (MAV) update 
Problem description: I would like a script that will trigger a Managed Antivirus (Bitdefender) update, utilizing an API call within the Dashboard. Instead of waiting for the next update scheduled in the policy, I need to map this script task to a failing Antivirus Update Check. 
Fix description: **VBScript that triggers a Managed Antivirus (Bitdefender) update on the target which the task is assigned to, by use of the RM Dashboard's API** *This script requires One Command Line Variable* *First Command Line: API key *Confirmed working in a Windows 7 (x64) and a Server 2008 R2 platform* ***Example Usage:*** APIkey
DownloadProblem title: Block Windows 10 Upgrade 
Problem description: Hello script experts! I'm looking for a RMM script that I can deploy to all managed Windows workstations that will (temporarily) block the upgrade to Windows 10. I want to avoid workstation users selecting to upgrade to Windows 10 when prompted by the new Windows Update prompts that are now occurring on all Windows 7 and 8 workstations that are not part of an Active Directory domain. It could be some time before the RMM software is updated to support Windows 10. I see one reference (only one?) online regarding a registry entry that may block the popups and installation of Windows 10. See the bottom of the post here... https://techjourney.net/disable-remove-get-windows-10-upgrade-reservation-notification-system-tray-icon/ I'd feel better if that information came from an official source. Thoughts or suggestions? What's the best way to deploy a registry change like the one suggested in the above URL? Perhaps then I could make a script check to alert on any workstations that don't have the block enabled. Thanks, in advance, for any help or suggestions. P.S. Anyone know how to assign this to a category? 
Fix description: This is simply a shorter version of the great .reg option (which could be used without the /apply to simply generate a file for a configuration management tool).

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.