N-able RMM: Community Scripts - Page Three

Last Modified

Tue Jan 29 14:07 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: Error code 0x80070646 or when installing Windows update 
Problem description: When installing Microsoft Office application updates using Windows Update or Microsoft Update on Windows 7, Vista or XP, one of the following error codes is received: Error Code: 0x80070646 Or Error Code: 646 or Error 1606 Could not access network location %APPDATA% 
Fix description: Click Start, and then in the Start Search box, type regedit. In the Programs list, right-click Regedit.exe, and then click Run as administrator. If you are prompted for an administrator password or for confirmation, type the password, or click Continue. Locate and then click the following registry subkey: HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders In the details pane of Registry Editor, locate AppData. The value of this key should be %USERPROFILE%\AppData\Roaming. If the value is not set to %USERPROFILE%\AppData\Roaming, right-click AppData in the details pane, and then click Modify. Enter %USERPROFILE%\AppData\Roaming into the Value data box, and then click OK. Close Registry Editor. Try to install the update again. If the problem persists, repeat these steps but use the following registry subkeys instead of the subkey that is specified in step 3: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders The PowerShell Script below should create the registry entry for you and assign the correct value.
DownloadProblem title: Report for machines missing a set of products . 
Problem description: A script to display a list of all the machines that have installed the software and separately list the machines that do not have this software 
Fix description: PowerShell script to generate report files the names of computers that have or miss the product. I tested on Windows 7 .
DownloadProblem title: Local Admin Account Enable 
Problem description: I found this script below that works but I need it modified to enable the local admin account. '--------------------------------------------------------------------- ' ' The following script is to be used to create a local ' user account and add it to the local Administrators ' group. To use, change the strLocalUserName to the desired ' name and change strLocalPassword to the password for the account. ' ' This script also will reset the password for the account if ' the account already exists and it will mark it as Hidden ' via a Registry key insertion. ' ' Please note, there is a limitation with the NET USER command ' where you are unable to set an account as 'never expires'. ' The bottom part of the script works arounds this. ' '--------------------------------------------------------------------- Set objShell = CreateObject ("WScript.Shell") Set Shell = Nothing on error resume next '--------------------------------------------------------------------- ' Create local account '--------------------------------------------------------------------- Wscript.Echo "Managing Administrative User Account" Set oWshNet = CreateObject("WScript.Network") strComputer = oWshNet.ComputerName strLocalUserName = "administrator" strLocalPassword = "PPCadmin!" strGroupname = "Administrators" Wscript.Echo "Variables Defined" WScript.Sleep(900) On Error Resume Next Set objUser = GetObject("WinNT://" & strComputer & "/" & strLocalUserName & ",user") If Err.Number <> 0 Then ' User account does not exist, create it. objShell.Run "NET USER "&strLocalUserName&" "&strLocalPassword&" /ADD " _ & "/ACTIVE:YES /COMMENT:""DedicatedIT Admin Account"" /FULLNAME:" _ & strLocalUserName &" /expires:never", 0, True Wscript.Echo "User Created" End If On Error Resume Next ' Try again Set objUser = GetObject("WinNT://" & strComputer & "/" & strLocalUserName & ",user") Wscript.Echo "User Exists" If Err.Number = 0 Then '--------------------------------------------------------------------- ' Set New Password if user exists '--------------------------------------------------------------------- objUser.SetPassword strLocalPassword objUser.SetInfo Wscript.Echo "Password Updated" '--------------------------------------------------------------------- ' Connect to the group '--------------------------------------------------------------------- Set objGroup = GetObject("WinNT://" & strComputer & "/" & strGroupname) '--------------------------------------------------------------------- ' Add the user account to the group ' Uses error handling in case it is a member already '--------------------------------------------------------------------- On Error Resume Next objGroup.Add(objUser.ADsPath) WScript.sleep 600 objGroup.Add(objUser.ADsPath) ' Error -2147023518 is "The specified account name is already ' a member of the local group." Wscript.Echo "Account Added to Administrators Group" '--------------------------------------------------------------------- ' Hide User Account '--------------------------------------------------------------------- HKEY_LOCAL_MACHINE = &H80000002 Set ObjRegistry = _ GetObject("winmgmts:{impersonationLevel = impersonate}!\\" _ & strComputer & "\root\default:StdRegProv") strPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList" Return = objRegistry.CreateKey(HKEY_LOCAL_MACHINE, strPath) Set oReg=GetObject( _ "winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList" oReg.SetDWORDValue _ HKEY_LOCAL_MACHINE,strKeyPath,strLocalUserName,1 Wscript.Echo "Account Hidden" End If '--------------------------------------------------------------------- ' Set Account password to never expire ' This is done externally due to NET USER limitations '--------------------------------------------------------------------- Const ufDONT_EXPIRE_PASSWD = &H10000 objUserFlags = objUser.Get("UserFlags") if (objUserFlags And ufDONT_EXPIRE_PASSWD) = 0 then objUserFlags = objUserFlags Or ufDONT_EXPIRE_PASSWD objUser.Put "UserFlags", objUserFlags objUser.SetInfo Wscript.Echo "Account Password set to never expire" end if 
Fix description: You can run this command in cmd . I hope it will be helpful for you .
DownloadProblem title: Automate Account Creation 
Problem description: Does anyone have a script to automate the account creation process? We usually create a default Windows 8 account and it would be great to expedite the process. Thank You. 
Fix description: Create a local hidden user account and add it to the local Administrators group ------ **I borrowed pieces from several other developer scripts and threw this together. I apologize to those developers, as I do not recall their info to provide proper credit.** 1. To use, change the **strLocalUserName** to the desired name and change **strLocalPassword** to the password for the account. 2. This script also will reset the password for the account if the account already exists and it will mark it as Hidden via a Registry key insertion. 3. Please note, due to a limitation with the NET USER command where you are unable to set an account as 'never expires', the bottom part of the script works around this.
DownloadProblem title: Set Local Administrator account password 
Problem description: Hey there, when we take over a company and roll out RMM, we also want the ability to change the local Administrator password on the PCs so that everyone is standardized. If possible, a list of all local users on PCs would also help. Any help on this would be appreciated. 
Fix description: Create a local hidden user account and add it to the local Administrators group ------ **I borrowed pieces from several other developer scripts and threw this together. I apologize to those developers, as I do not recall their info to provide proper credit.** 1. To use, change the **strLocalUserName** to the desired name and change **strLocalPassword** to the password for the account. 2. This script also will reset the password for the account if the account already exists and it will mark it as Hidden via a Registry key insertion. 3. Please note, due to a limitation with the NET USER command where you are unable to set an account as 'never expires', the bottom part of the script works around this.
DownloadProblem title: Install Malwarebytes 
Problem description: Hello, I'm looking for a 'Automated Task' for silently install the free edition of Malwarebytes to workstations from within the RMM console.. Best regards, Victor 
Fix description: Small Vbscript to silently install Malwarebytes .Without RMM .
DownloadProblem title: Show or Hide file name extensions. 
Problem description: No big script to show(hide) file extensions . 
Fix description: Script to toggle Windows Explorer display of file name extensions .
DownloadProblem title: Show or Hide file name extensions. 
Problem description: No big script to show(hide) file extensions . 
Fix description: Script to show or hide name extensions . This version can be run RMM, and needn't refresh the PC for the change to take effect .
DownloadProblem title: Download and install Adobe/Java silently 
Problem description: I've seen the entries on how to install java *if* the download items are already on the machine, is there a way of putting a vb script to download and install the latest versions from the relevant sites but also in a silent way so that users are not aware? 
Fix description: I use this batch file to download and install Adobe last version .
DownloadProblem title: I need some custom RMM scripts! 
Problem description: I am terrible at writing scripts and am looking for some one that can or already has. I would like a script, or scripts, to clean up a computer. Want to automate running the following programs: - "RKill" (http://www.bleepingcomputer.com/download/rkill/) - "TDSSKiller" (http://download.cnet.com/Kaspersky-TDSSKiller/3000-2239_4-12684178.html) - "Malwarebytes" (http://www.malwarebytes.org/) - "Superantispyware" (http://www.superantispyware.com/) - "Ccleaner" (http://www.piriform.com/ccleaner) - "StartUpLite" (http://www.malwarebytes.org/products/startuplite/). I can even provide a test machine if needed. You may contact me privately if you prefer. 
Fix description: This small vbscript to auto run CCleaner.exe .
DownloadProblem title: I need some custom RMM scripts! 
Problem description: I am terrible at writing scripts and am looking for some one that can or already has. I would like a script, or scripts, to clean up a computer. Want to automate running the following programs: - "RKill" (http://www.bleepingcomputer.com/download/rkill/) - "TDSSKiller" (http://download.cnet.com/Kaspersky-TDSSKiller/3000-2239_4-12684178.html) - "Malwarebytes" (http://www.malwarebytes.org/) - "Superantispyware" (http://www.superantispyware.com/) - "Ccleaner" (http://www.piriform.com/ccleaner) - "StartUpLite" (http://www.malwarebytes.org/products/startuplite/). I can even provide a test machine if needed. You may contact me privately if you prefer. 
Fix description: VBscript to clean up a computer with automatically running "CCleaner" . This version of script can be run in RMM.
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: Here is a quick powershell script to list all the free disk space on the available drives.
DownloadProblem title: System Install Date 
Problem description: Is there a way to get an installation date System(OS) to a given computer name? 
Fix description: VBscript for the return of the date of installation of the Windows OS .
DownloadProblem title: Hyper-V Monitoring Scripts 
Problem description: Would be nice to have some script to monitoring Hyper-V (like VM status, dynamic memory allocation refused, dynamic memory status/max, etc.) 
Fix description: PowerShell command will return Virtual Machine's Name, State and etc. on Windows Server 2012.
DownloadProblem title: TeamViewer automatic update settings 
Problem description: So TeamViewer comes out of the "box" ready to ensure it is up-to-date within the major version downloaded or installed. When deployed by an MSP that may or may not update to the next Major Version, or when deployed as **Take Control** in **Remote**Management, we don't _need_ to update to any version; at the least we'd like to _control_ it. So how about ***disabling*** the automatic update features? 
Fix description: This script is coded to look for and change the settings in TeamViewer 8. One can see how it could be changed for other versions.
DownloadProblem title: Date Time and contents of text file captured in to RMM 
Problem description: I have a scheduled task that runs and when it is done puts the results in a text file. I would like a script for RMM that will capture the date and time a file is created (or modified either will work) along with the contents of this text file. 
Fix description: Powershell script to monitoring .text file . It will capture created(last modified) date and file's content .
DownloadProblem title: Script to send an alarm if a file(s) older than 
Problem description: Script to send an alarm if a file is older than a specified number of days. 
Fix description: PowerShell script to send alarm if file is older than a specified number of days .
DownloadProblem title: Date Time and contents of text file captured in to RMM 
Problem description: I have a scheduled task that runs and when it is done puts the results in a text file. I would like a script for RMM that will capture the date and time a file is created (or modified either will work) along with the contents of this text file. 
Fix description: Powershell script to capture created(last modified) date and file's content . This version of script can be run in RMM.
DownloadProblem title: Script to send an alarm if a file(s) older than 
Problem description: Script to send an alarm if a file is older than a specified number of days. 
Fix description: PowerShell script can be run in RMM . it takes file's path as argument and gives warning (as MsgBox) if the file is older than a specified number of days.(For example 15 days).
DownloadProblem title: Check latest Veeam Backup with RMM 
Problem description: I could need a script: RMM starts it, the script checks the veeam-sql table if the latest backup was made (according to local system time, compared to the backup-time in the sql-table), after that it also checks if the backup was successful. If both checks say, everything is fine, I want to see a "Everything is fine" in the RMM webinterface, if not there should be something like "Backup faulty!" Regards, T. Erdogan 
Fix description: A bit of a crude script here but does the job for me. Basically checks the specified folder and returns error if no files exist newer than 24hrs ago. Assumes if a file exists, the backup was successful.
DownloadProblem title: Check AV status for RMM 
Problem description: I found the following script on Technet Script Center which I would like to use to monitor the AV status of workstations. Can this be modified to: - only check the AV status of the local PC (no remote PCs) - work with RMM. Any help would be appreciated! Powershell script: function Get-LHSAntiVirusProduct { <# .SYNOPSIS Get the status of Antivirus Product on local and Remote Computers. .DESCRIPTION It works with MS Security Center and detects the status for most AV products. Note that this script will only work on Windows XP SP2, Vista and 7 operating systems as Windows 2000 and Server 2003/2008/2008R2 does not have the required WMI SecurityCenter\SecurityCenter name spaces. .PARAMETER ComputerName The computer name(s) to retrieve the info from. .EXAMPLE Get-LHSAntiVirusProduct ComputerName : N104100 Name : Kaspersky Anti-Virus ProductExecutable : C:\Program Files (x86)\Kaspersky Lab\Kaspersky Anti-Virus 6.0 for Windows Workstations MP4\wmiav.exe DefinitionStatus : Up to date RealTimeProtectionStatus : Enabled .EXAMPLE Get-LHSAntiVirusProduct –ComputerName PC1,PC2,PC3 .EXAMPLE (get-content PClist.txt) | Get-LHSAntiVirusProduct .INPUTS System.String, you can pipe ComputerNames to this Function .OUTPUTS psobject Custom PSObjects containing the following properties: ComputerName : as String Name : Antivirus Product Name as String ProductExecutable : as String DefinitionStatus : as String like 'Up to date' RealTimeProtectionStatus : as String like 'Enabled' .NOTES WMI query to get anti-virus infor­ma­tion has been changed. Pre-Vista clients used the root/SecurityCenter name­space, while Post-Vista clients use the root/SecurityCenter2 name­space. But not only the name­space has been changed, The properties too. More info at http://neophob.com/2010/03/wmi-query-windows-securitycenter2/ and from this MSDN Blog http://blogs.msdn.com/b/alejacma/archive/2008/05/12/how-to-get-antivirus-information-with-wmi-vbscript.aspx AUTHOR: Pasquale Lantella LASTEDIT: KEYWORDS: .LINK #Requires -Version 2.0 #> [CmdletBinding()] [OutputType('PSobject')] param ( [parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [Alias('CN')] [String[]]$ComputerName=$env:computername ) BEGIN { Set-StrictMode -Version Latest ${CmdletName} = $Pscmdlet.MyInvocation.MyCommand.Name Write-Verbose -Message "${CmdletName}: Starting Begin Block" Write-Debug -Message "${CmdletName}: Starting Begin Block" } # end BEGIN PROCESS { Write-Verbose "${CmdletName}: Starting Process Block" Write-Debug ("PROCESS:`n{0}" -f ($PSBoundParameters | Out-String)) ForEach ($Computer in $computerName) { Write-Debug "`$Computer contains $Computer" IF (Test-Connection -ComputerName $Computer -count 2 -quiet) { $OSVersion = (Get-WmiObject win32_operatingsystem -computername $Computer).version $OS = $OSVersion.split(".") Write-Debug "`$OS[0]: $($OS[0])" IF ($OS[0] -eq "5") { Write-Verbose "Windows 2000, 2003, XP" Try { $AntiVirusProduct = Get-WmiObject -Namespace root\SecurityCenter -Class AntiVirusProduct -ComputerName $Computer -ErrorAction Stop } Catch { Write-Error "$Computer : WMI Error" Write-Error $_ Continue } # Output PSCustom Object $AV = $Null $AV = New-Object PSObject -Property @{ ComputerName = $AntiVirusProduct.__Server; Name = $AntiVirusProduct.displayName; versionNumber = $AntiVirusProduct.versionNumber; onAccessScanningEnabled = $AntiVirusProduct.onAccessScanningEnabled; productUptoDate = $AntiVirusProduct.productUptoDate; } | Select-Object ComputerName,Name,versionNumber,onAccessScanningEnabled,productUptoDate $AV } ElseIF ($OS[0] -eq "6") { Write-Verbose "Windows Vista, 7, 2008, 2008R2" Try { $AntiVirusProduct = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct -ComputerName $Computer -ErrorAction Stop } Catch { Write-Error "$Computer : WMI Error" Write-Error $_ } # Switch to determine the status of antivirus definitions and real-time protection. # The values in this switch-statement are retrieved from the following website: http://community.kaseya.com/resources/m/knowexch/1020.aspx switch ($AntiVirusProduct.productState) { "262144" {$defstatus = "Up to date" ;$rtstatus = "Disabled"} "262160" {$defstatus = "Out of date" ;$rtstatus = "Disabled"} "266240" {$defstatus = "Up to date" ;$rtstatus = "Enabled"} "266256" {$defstatus = "Out of date" ;$rtstatus = "Enabled"} "393216" {$defstatus = "Up to date" ;$rtstatus = "Disabled"} "393232" {$defstatus = "Out of date" ;$rtstatus = "Disabled"} "393488" {$defstatus = "Out of date" ;$rtstatus = "Disabled"} "397312" {$defstatus = "Up to date" ;$rtstatus = "Enabled"} "397328" {$defstatus = "Out of date" ;$rtstatus = "Enabled"} "397584" {$defstatus = "Out of date" ;$rtstatus = "Enabled"} default {$defstatus = "Unknown" ;$rtstatus = "Unknown"} } # Output PSCustom Object $AV = $Null $AV = New-Object -TypeName PSobject -Property @{ ComputerName = $AntiVirusProduct.__Server; Name = $AntiVirusProduct.displayName; ProductExecutable = $AntiVirusProduct.pathToSignedProductExe; DefinitionStatus = $defstatus; RealTimeProtectionStatus = $rtstatus } | Select-Object ComputerName,Name,ProductExecutable,DefinitionStatus,RealTimeProtectionStatus $AV } Else { Write-Error "\\$Computer : Unknown OS Version" Exit } # end If $OS } Else { Write-Warning "\\$computer DO NOT reply to ping" } # end IF (Test-Connection -ComputerName $Computer -count 2 -quiet) } # end ForEach ($Computer in $computerName) } # end PROCESS END { Write-Verbose "Function Get-LHSAntiVirusProduct finished." } } # end function Get-LHSAntiVirusProduct 
Fix description: PowerShell script to check AntiVirusProduct Status of the local PC . Script can be run in RMM . This version only for Windows Vista, 7, 2008, 2008R2.
"

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.