Inital commit.

This commit is contained in:
2019-11-11 19:22:39 -05:00
parent f89d330f14
commit a052b43b22
80 changed files with 5989 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
## Set the temporary directory used for uploading to FTP site
$TEMPDIR = "${Env:ProgramData}\Emberkom\Temp"
If (! (Test-Path -PathType Container $TEMPDIR) ) { New-Item -ItemType Directory -Force -Path $TEMPDIR }
## Set the file name for the Ninja logs when it's uploaded
$NINJALOGS = "{0}_{1}.cab" -f ${Env:ComputerName}, $(Get-Date -Format "yyyyMMdd-HHmmss")
## Get the NinjaRMM installation directory
If (Test-Path "${Env:ProgramFiles(x86)}") {
$INSTALLDIR = $(Get-ItemProperty -Path 'HKLM:\SOFTWARE\WOW6432Node\NinjaRMM LLC\NinjaRMMAgent' -Name Location).Location
} Else {
$INSTALLDIR = $(Get-ItemProperty -Path 'HKLM:\SOFTWARE\NinjaRMM LLC\NinjaRMMAgent' -Name Location).Location
}
## Collect agent logs
Start-Process -FilePath "${INSTALLDIR}\ninjarmmagent.exe" -ArgumentList "/collectlogs" -Wait
## Move ninjalogs.cab to $TEMPDIR
Move-Item -Path "${Env:WINDIR}\Temp\ninjalogs.cab" -Destination "${TEMPDIR}\${NINJALOGS}"
## Upload to FTP