-
Notifications
You must be signed in to change notification settings - Fork 0
/
runPowerShellScriptViaLogMeInRescueTechnicianConsole.bat
26 lines (23 loc) · 1.47 KB
/
runPowerShellScriptViaLogMeInRescueTechnicianConsole.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
@echo off
REM # .VERSION 1.0.0
REM # .DESCRIPTION Execute PowerShell scripts via LogMeIn Rescue Technician Console.
REM # .AUTHOR Wojciech Ros (code@unsola.ci)
REM # .COPYRIGHT Copyright (C) Wojciech Ros (code@unsola.ci)
REM # .LICENSEURI http://www.apache.org/licenses/LICENSE-2.0
REM # .GUID af95d8c5-be69-41da-9f75-32eacdefc273
REM #
setlocal EnableDelayedExpansion
REM # Only change these
set resourceZipFileName=yourResourceZipFileName.zip
set powershellScriptFileName=yourPowershellScriptFileName.ps1
set additionalPowershellExeParameters=-ExecutionPolicy Bypass
REM # Don't change these
set cmdScriptRoot=%~dp0
set cmdScriptRoot=%cmdScriptRoot:~0,-1%
set powershellScriptFile=%cmdScriptRoot%\%powershellScriptFileName%
set resourceZipFile=%cmdScriptRoot%\%resourceZipFileName%
REM # Store PowerShell command strings in variables to avoid escape hell and problems due to cmd.exe's quirkiness
set expandResourceFileCommandString=Expand-Archive -Path '%resourceZipFile%' -DestinationPath '%cmdScriptRoot%' -Force -Verbose
set executePowershellScriptCommandString='%powershellScriptFile%'
REM # Run PowerShell: expand resourceZipFile and execute powershellScriptFile
powershell.exe %additionalPowershellExeParameters% -Command "& { & %expandResourceFileCommandString% ; & %executePowershellScriptCommandString% }"