N-able RMM: Community Scripts - Page Thirteen

Last Modified

Tue Jan 29 14:12 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: Modify "List Client and Site ID" PS script to list workstations also. 
Problem description: Hi I am hoping to be able to list client name, site name, workstation name, make, model, serial, etc for all of our client sites in one form. That I can then load into Dynamics CRM. I found [this](http://www.fixitscripts.com/problems/list-site-and-client-ids-for-use-with-the-RMM-max-api) and it runs great and I figured I could just add another section for the workstations. Any input? Any reason the code below isnt working? Write-Host "Connecting to RMM and looking for IDs" $ClientsURL = "$APIurl&service=list_clients" $wsTable = @() # Loop through the clients in your dashboard [xml]$XMLclients = (new-object System.Net.WebClient).DownloadString($ClientsURL) foreach ($XMLclientsList in $XMLclients.result.items.client) { $ClientID = $XMLclientsList.clientid $ClientName = $XMLclientsList.name."#cdata-section" $SiteURL = "$APIurl&service=list_sites&clientid=$ClientID" [xml]$XMLSite = (new-object System.Net.WebClient).DownloadString($SiteURL) # Loop through the sites within each of your clients foreach ($XMLSiteList in $XMLSite.result.items.site) { $SiteID = $XMLsiteList.siteid $SiteName = $XMLsiteList.name."#cdata-section" $workstationURL = "$APIurl&service=list_workstations&siteid=$SiteID" [xml]$XMLworkstation = (new-object System.Net.WebClient).DownloadString($workstationURL) # Loop through the workstations within each of your sites foreach ($XMLworkstationList in $XMLworkstation.result.items.workstation) { $workstationID = $XMLworkstationList.workstationid $workstationName = $XMLworkstationList.name."#cdata-section" # Write-Host "Client: $ClientName" "$ClientID" "Site: $SiteName" "$SiteID" "Workstation: $workstationName" "$workstationID" $wsObj = " " | select ClientName,ClientID,SiteName,SiteID,workstationName,workstationID $wsObj.ClientName = $ClientName $wsObj.ClientID = $ClientID $wsObj.SiteName = $SiteName $wsObj.SiteID = $SiteID $wsObj.workstationName = $workstationName $wsObj.workstationID = $workstationID $wsTable += $wsObj } # Add a blank line after each client $wsTable += " " } write-host "A list of RMM ID's has been saved to: $OutFileLoc" # Output the file, could also auto send an email $wsTable $wsTable | Format-Table -AutoSize | Out-File -filepath C:\Temp\RMMapitest.txt if ($sendMail) { write-host "Sending email to $TOaddress" $MsgBody = " Client and Site ID's from RMM M" -join '
' $MsgBody += '
' $MsgBody += ( Get-Content -Path $OutFileLoc -Encoding Ascii -Force) -join '
' $MsgAttachment = "$OutFileLoc" $Message = new-object System.Net.Mail.MailMessage $Message.From = $FROMaddress $Message.To.Add($TOaddress) #$Message.CC.Add($CCaddress) #$Message.Bcc.Add($BCCaddress) $Message.IsBodyHtml = $True $Message.Subject = $emailSubject $MsgAttachment = new-object Net.Mail.Attachment($MsgAttachment) $Message.Attachments.Add($MsgAttachment) $Message.body = $MsgBody $smtp = new-object Net.Mail.SmtpClient($SMTPserver) $smtp.Send($Message) } Write-host "Script Completed" # EOF Thanks so much. 
Fix description: Hi, I'm no programmer but I made a few small modifications and took back the original variables, seems to work. I know it's been a long time but if you still need it I'd appreciate a feedback :) Regards, Antoine
DownloadProblem title: Execution Policy and Powershell Script Time Outs 
Problem description: Hello All, I was wondering if it is helpful to begin a PowerShell script by setting the Execution Policy to Unrestricted? I have a script that seems to work well 80% of the time but from time to time I get Script timed out errors in RMM. If I go to that server and open PowerShell and Set the Execution Policy to Unrestricted and then trigger the Script Check from RMM it will check successfully. Not sure if this would resolve the issue for the last 20% but wanted to get some feedback from others if you have seen this issue? All best... Jason 
Fix description: Hello, it is not a good idea to leave computers much less servers with their execution policies left to Unrestricted. The best way to do this in my opinion is to use PowerShell parameters to bypass the execution policy temporarily.
DownloadProblem title: Script to enable Local Audit event logs Success or/and fail 
Problem description: I would like to have a task to push to each device that can enable Security Event Audit logs in Windows 7 and above. 
Fix description: Simple batch script to enable Failed Login attempts and it will enable Login Success.
DownloadProblem title: Batch issue with "missing operator" 
Problem description: I wrote a batch script for MaxRM that sets off an alarm if the server's clock is not synchronized. The script works perfectly - apart from some annoying output line saying "missing operator". Here's the code: @echo off REM Lennart Schuetz 2017/03 REM Checks the time difference between this machine and pool.ntp.org REM A difference greater than 60 seconds will cause the check to fail setlocal setlocal enabledelayedexpansion setlocal enableextensions set timeSkew=0 for /f "tokens=* skip=3 usebackq" %%i in (`w32tm /stripchart /computer:pool.ntp.org /samples:1 /dataonly`) do ( set line=%%i set /a timeSkew=!line:~11,4!*1) echo Time skew: %timeSkew% seconds if %timeSkew% LEQ 60 (exit 0) else (exit 1001) So the script output will not be "Time skew: 10 seconds", but "Missing operator Time skew: 10 seconds". As far as I see, this comes from the line starting with "set /a", but I have no idea how to get rid of this. I even tried to add "> NUL" at the end of the line, but with no effect. Any ideas? 
Fix description: Batch scripting does not support the decimal in a set expression, whole numbers only. I updated your script to pull out the first part of the info from ntp and only show the difference in time, then set the entire amount of time as the timeskew variable. I have verified this errors out appropriately and will trigger an alert in MAX.
DownloadProblem title: Teamviewer Silent Uninstall VBS 
Problem description: We built this Script to uninstall an auto update to Teamviewer that was provided by RMM. The update broke our take control capabilities. It is recommended to turn off Take Control globally, then ignore updates to Teamviewer in the Patch Management User Policies. After that, upload script to the User Scripts and run across all sites. Once this is done turn Take Control back on. Dim objShell Set objShell = WScript.CreateObject( "WScript.Shell" ) objShell.Run "taskkill /im teamviewer.exe", , True objShell.Run "taskkill /im teamviewer.exe", , True Teamviewer Sub Teamviewer() On Error Resume Next objShell.Run("""%ProgramFiles%\TeamViewer\Version6\uninstall.exe"" /S") objShell.Run("""%ProgramFiles%\TeamViewer\Version7\uninstall.exe"" /S") objShell.Run("""%ProgramFiles%\TeamViewer\Version8\uninstall.exe"" /S") objShell.Run("""%ProgramFiles%\TeamViewer\Version9\uninstall.exe"" /S") End Sub Set objShell = Nothing Thanks, Matthew Chisenhall Mattchis Technologies 
Fix description: Uninstalling Teamviewer or teamviewer host, any version. Other scripts I see posted don't stop and kill the service. I recently needed to downgrade 53 EU's that got upgraded to higher version than the client was licensed for. I used this CMD file and it worked fine. After running this, the MSI for the earlier version TV host was able to install in the background without issue.
DownloadProblem title: read windows application event log for source ABC 
Problem description: I have a script that runs a program. This program writes all it's results in the windows application even log under source ABC. Is their anyway to get these results and output them to the dashboard using wscript.Echo or similar? The event produces several lines so would need them all caputred
Fix description: Here is some code that should help you get it done. I pulled most of the code from here: http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/28c7d7bc-29da-485c-9ca0-b23f2d42205c/ I added some comments and a couple lines of code at the beginning to make the stdout.WriteLine stuff work. I tested this in RMM to be sure I received the expected results. Cheers, Tim
DownloadProblem title: Looking for a script that will return the age of a machine 
Problem description: I know there are several areas to look for age of a machine such as BIOS, create date of OS files etc, but each of these can be way off the mark depending on the history of the machine. Does anyone have a really good way of bringing back the true age (or as close as you can get)? 
Fix description: Here's a VBScript script to get local computer age. It will run in MAX RemoteManagement
DownloadProblem title: How to write a script to unistall one versian of Java and then to install another one? 
Problem description: Currently we have two versions of java installed on all machines at one of our networks. On is the latest version 6 and another one which is version 1.0.7 . I need to uninstall the 1.0.7 and then replace it 1.0.6 which is an older version. I have the .exe file for the replacement java . Currently both are installed under programs( x86) under a java folder. So, I don't want to touch version 6, but uninstall 1.0.7 and install 1.0.6. All computers are running win 7 pro 64 bit. Thank you, 
Fix description: PowerShell script to uninstall Java one version and install another version . Please Be sure to edit the location of the installers. Use Script with PowerShell Run as Administrator.
DownloadProblem title: Defrag Hard Disk if need 
Problem description: PowerShell script to execute a disk defrag if the disk needs to be defragmented 
Fix description: This is a PowerShell function which will allow you to perform a disk defragmentation on a windows volume. The function allows you to run a disk defragmentation against a specific volume on a computer and also accepts input on the pipeline from my Get-DefragStatus function. Please note that Unless your computer is running WIndows XP /Vista Defragging manually is not required. Windows 7 & 8 Takes care of disk defragmentation by itself if you have it turned on.
DownloadProblem title: I want to join a computer to the domain 
Problem description: Is there a script that will let me join a computer to our domain? 
Fix description: This script mimics the basic functionality of the Add-Computer cmdlet (with reduced functionality). It prompts the administrator for credentials to add a computer to the domain. It then retrieves the WMI ComputerSystem object and uses the JoinDomainOrWorkgroup method to join
DownloadProblem title: RMM Check: Monitor Hyper-V Replica (HVR) status 
Problem description: Want a way to monitor Hyper-V Replica status for 2012 Servers 
Fix description: You can view this information by using the Get-VMReplication command.
DownloadProblem title: Windows update settings 
Problem description: PowerShell script to change windows automatic update settings. 
Fix description: Powershell script to change the settings of Windows update services.
DownloadProblem title: Windows update settings 
Problem description: PowerShell script to change windows automatic update settings. 
Fix description: This PowerShell script will change the settings of Windows update services for you and can be run through MAX RemoteManagement.
DownloadProblem title: Set Internet Explorer Homepage.. 
Problem description: Hi, I am an IT manager and my employer wants all the computers in the company to display the same Homepage. Can anyone out there help me with this problem? 
Fix description: This is a VB Script that will change the IE homepage for any systems the script is run on. Simply change the URL with your URL in the variable named "strHomePage".
DownloadProblem title: Script to Install Java 
Problem description: Batch script to install Java on both 32-bit and 64-bit Windows operating systems . 
Fix description: This batch file will install Java on both 32-bit and 64-bit Windows operating systems .Without Restart.
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: Perl script to check Time Machine backups. Add this script as a daily safety check. It has been tested on OSX Lion and Mountain Lion. It will flag as an identified problem on the "Client Daily Report" and on your dashboard if it has been longer than 8 hours since a "Backup completed successfully" message was found in the system log file. For all OSX devices that are being backed up, it will put this message to the daily report as of the last dsc: > Minutes since last successful backup: *nn* If it has been longer than 8 hours since a good backup then the daily report will flag a red x and output this message to the report: > Error: Backup from *nn* hours ago is too old! Backup > 8 hours ago.
DownloadProblem title: Change service startup 
Problem description: I'm looking for a way to change a service startup by service name (so basically): sc config "servicename" start= disabled/manual/automatic If the service is set to automatic then start it, and if it's set to disabled stop it. And then exit with an code so I know if it worked or not. 
Fix description: Powershell script will check If startmode of selected service is automatic then Start this service, and if it's disabled Stop it. Script must be run through Windows PowerShell Run as Administrator .
DownloadProblem title: Script to install Adobe Reader 
Problem description: Script to install Adobe Reader on Windows operating systems . With or Without Restart . 
Fix description: PowerShell script to install Adobe Reader on Windows operating systems without Restart . Be sure to edit the location of the installers.
DownloadProblem title: Create Hyper-V Virtual Machine 
Problem description: Need to create and configure virtual machines on Windows Server . I think using Windows PowerShell can do it faster. 
Fix description: I use this script on Windows Server 2008.
DownloadProblem title: Finding the free space on my local and remote hard disks? 
Problem description: It seems to be an issue where i have a tough time quickly finding the free space available on my network drives or local drives. I would think there would be a easy way to script this. Can anyone help? 
Fix description: For MAX Management, check size and free space of unc drive, even on linux smb shares, check permission on remote share.
DownloadProblem title: Defrag Hard Disk if need 
Problem description: PowerShell script to execute a disk defrag if the disk needs to be defragmented 
Fix description: PowerShell script will execute a disk defrag if if the disk needs to be defragmented. Used the class Win32_Volume and the method DefragAnalysis().
DownloadProblem title: Defrag Hard Disk if need 
Problem description: PowerShell script to execute a disk defrag if the disk needs to be defragmented 
Fix description: This version of script for you and can be run through MAX Remote Management.
DownloadProblem title: Display IE Version 
Problem description: Need to script for display Internet Explorer Version (Major and Installed) 
Fix description: No parameter If you want can't edit $programs array to add more default application installed on your computer output: Success Message Internet Explorer 10.00.9200.16384 (win8_rtm.120725-1247) Tested: Windows Vista Windows 7 Windows 8 Windows 2008 Windows 2008R2 Windows 2012 This script can be run in RMM.
DownloadProblem title: Looking for a script that will return the age of a machine 
Problem description: I know there are several areas to look for age of a machine such as BIOS, create date of OS files etc, but each of these can be way off the mark depending on the history of the machine. Does anyone have a really good way of bringing back the true age (or as close as you can get)? 
Fix description: Now you can use LanGuard to scan the network run the script and return the age of each machine on a network.

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.