Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #lines 2-8 can be removed if your current RMM runs the deployed script as an administrator or "system" user. Lines 2-8 will request admin permissions if not available.
- If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
- {
- $arguments = "& '" + $myinvocation.mycommand.definition + "'"
- Start-Process powershell -Verb runAs -ArgumentList $arguments
- Break
- }
- #url of downloaded file - FULL URL including extension (e.g. http://www.myweb.net/downloadthisifle.exe)
- $dlURL = "http://www.dropbox.com/whatever/file.exe"
- #destination of downloaded file on local machine.
- # $env:TEMP translates to %temp% environment variable in PS.
- $dlDest = "$($env:TEMP)\MyDownloadedFile.exe"
- #let's download the file
- Invoke-WebRequest $dlURL -OutFile $dlDest
- #Required registry entries per: https://support.avg.com/SupportArticleView?l=en_US&urlname=Managed-Workplace-Automating-Silent-Device-Manager-Deployment
- #I'm too lazy to deal with first checking to see if the key exists and if not create the keys, then the values, then the data inside of PS. Did it from command line instead.
- reg add "HKLM\SOFTWARE\Level Platforms\ManagedWorkplace\Onsite Manager\Install" /v DMSilentMode /d true /f
- Start-Process -FilePath $dlDest -ArgumentList "-y" -Wait -Passthru
Advertisement
Add Comment
Please, Sign In to add comment