First working version
commit
57a10e597d
@ -0,0 +1,10 @@
|
||||
## IServ Package as alternative to iserv-windows-batch to run PowerShell scripts straight from the IServ portal server on a target Windows machine
|
||||
|
||||
### Installing
|
||||
- Put all files of this repo into `/srv/deploy/install/powershell-runner` on the IServ portal server
|
||||
- Run chkdeploy as root/with sudo
|
||||
- Create the directory that holds the PowerShell scripts:
|
||||
- `# mkdir /srv/appdata/powershell-runner`
|
||||
- Adjust directory permissions and ownership so admins can put script files there
|
||||
- `# chown pcpatch:admins /srv/appdata/powershell-runner`
|
||||
- `# chmod 0570 /srv/appdata/powershell-runner`
|
||||
@ -0,0 +1,14 @@
|
||||
[Product]
|
||||
type: localboot
|
||||
id: powershell-runner
|
||||
name: PowerShell Script Runner
|
||||
description: Dieses Paket führt PowerShell Scripte direkt von IServ aus
|
||||
version: 1.0
|
||||
packageVersion: 1.0
|
||||
setupScript: install.ins
|
||||
|
||||
[ProductProperty]
|
||||
name: filename
|
||||
description: Skriptname (ohne Endung)
|
||||
default: start
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
[Initial]
|
||||
Message=Starte PowerShell Script...
|
||||
DefVar $ExitCode$
|
||||
DefVar $FileName$
|
||||
DefVar $Hostname$
|
||||
DefVar $KeyPath$
|
||||
|
||||
[Actions]
|
||||
ShowBitmap "%ScriptPath%\logo.png" "PowerShell"
|
||||
Sub_PrepInstall
|
||||
DosInAnIcon_Setup
|
||||
Sub_HandleExitCode
|
||||
ExitWindows /Reboot
|
||||
|
||||
[Sub_PrepInstall]
|
||||
Set $FileName$ = GetProductProperty("filename", "start")
|
||||
if ($FileName$ = "")
|
||||
Set $FileName$ = "start"
|
||||
endif
|
||||
Set $Hostname$ = Lower(Trim(TakeString(0, GetReturnListFromSection("opsiservicecall_GetHostname"))))
|
||||
Set $KeyPath$ = "\\" + $Hostname$ + "\appdata\%installingProdName%\"
|
||||
if not(FileExists($KeyPath$+ $FileName$ + ".ps1"))
|
||||
LogError "Fatal: File " + $FileName$ + ".ps1 not found."
|
||||
IsFatalError
|
||||
endif
|
||||
|
||||
[opsiservicecall_GetHostname]
|
||||
"method":"iserv_cfg"
|
||||
"params":[
|
||||
"Hostname"
|
||||
]
|
||||
|
||||
[DosInAnIcon_Setup]
|
||||
@echo off
|
||||
pushd "\\iserv\appdata\%installingProdName%"
|
||||
powershell -ExecutionPolicy Bypass -File "$FileName$.ps1"
|
||||
|
||||
[Sub_HandleExitCode]
|
||||
Set $ExitCode$ = GetLastExitCode
|
||||
comment "DISM exit code: " + $ExitCode$
|
||||
if not($ExitCode$ = "0")
|
||||
LogError "Fatal: DISM quit with exit code " + $ExitCode$
|
||||
IsFatalError
|
||||
endif
|
||||
Loading…
Reference in New Issue