From 6aa581a222e02b06430d42a96c252c9c5ca2ff9d Mon Sep 17 00:00:00 2001 From: "Michael H.G. Schmidt" Date: Tue, 13 Dec 2022 16:29:35 +0100 Subject: [PATCH] some fixes --- 06_Copy2Stick.cmd | 14 ++++--- optional/install-emclient.cmd | 23 +---------- scripts/set-explorer-viewmode.ps1 | 2 +- tools/logon.cmd | 69 +++++++++++++++++++++++++++---- 4 files changed, 71 insertions(+), 37 deletions(-) diff --git a/06_Copy2Stick.cmd b/06_Copy2Stick.cmd index 8fb65c6..b706a63 100644 --- a/06_Copy2Stick.cmd +++ b/06_Copy2Stick.cmd @@ -11,19 +11,21 @@ rem =================== rem CONFIGFILE CHECK rem =================== -rem GLOBAL settings ... -if EXIST %SCRIPT_SETTINGS% ( - call %SCRIPT_SETTINGS% -) else ( +echo searching for SCRIPT settings ... +if NOT EXIST %SCRIPT_SETTINGS% ( + echo INFO: config file %COMPANY_SETTINGS% NOT FOUND set LANG=en-US +) else ( + echo OK. Loading SCRIPT settings ... + call %SCRIPT_SETTINGS% ) echo LANG=%LANG% -rem COMPANY settings ... set support_user= set support_password= +echo searching for COMPANY settings ... if NOT EXIST %COMPANY_SETTINGS% ( - echo INFO: COMPANY %COMPANY_SETTINGS% NOT FOUND + echo INFO: config file %COMPANY_SETTINGS% NOT FOUND ) else ( echo OK. Loading COMPANY settings ... call %COMPANY_SETTINGS% diff --git a/optional/install-emclient.cmd b/optional/install-emclient.cmd index 79913ce..d790907 100644 --- a/optional/install-emclient.cmd +++ b/optional/install-emclient.cmd @@ -5,8 +5,6 @@ if %ERRORLEVEL% neq 0 exit /b set OPT=..\optional set SOFTWARE=..\software set MSI=emclient-setup.msi -set SETTINGS=..\company\settings.cmd -set emclient_license=0 set EMSERVERIP=168.62.48.183 if NOT EXIST %SOFTWARE%\%MSI% ( @@ -14,18 +12,6 @@ if NOT EXIST %SOFTWARE%\%MSI% ( exit /b ) -rem =================== -rem CONFIGFILE CHECK -rem =================== - -if NOT EXIST %SETTINGS% ( - echo. - echo WARNING: %SETTINGS% NOT FOUND - echo. -) else ( - call %SETTINGS% -) - echo ####### %0 ####### echo installing em-Client ... @@ -53,14 +39,7 @@ netsh advfirewall firewall delete rule name="block_emclient_updates" 2>nul netsh advfirewall firewall add rule name="block_emclient_updates" ^ dir=out action=block protocol=tcp localip=any remoteip=%EMSERVERIP% ^ remoteport=80,443 program="%ProgramFiles(x86)%\eM Client\MailClient.exe" - -if emclient_license == 0 ( - echo no em Client license found! -) else ( - echo adding em Client license ... - "%ProgramFiles(x86)%\eM Client\MailClient.exe" /deactivate - "%ProgramFiles(x86)%\eM Client\MailClient.exe" /activate %emclient_license% -) +echo. echo ####### %0 ####### pause diff --git a/scripts/set-explorer-viewmode.ps1 b/scripts/set-explorer-viewmode.ps1 index 292598b..d945623 100644 --- a/scripts/set-explorer-viewmode.ps1 +++ b/scripts/set-explorer-viewmode.ps1 @@ -41,7 +41,7 @@ Get-ChildItem $topViews | % { } write-host 'restarting explorer ...' -Get-Process Explorer | Stop-Process +Get-Process Explorer | ? {$_.SI -eq (Get-Process -PID $PID).SessionId} | Stop-Process write-host '#######',(split-path $PSCommandPath -Leaf),'#######' diff --git a/tools/logon.cmd b/tools/logon.cmd index 5ddbb8d..0be8e11 100644 --- a/tools/logon.cmd +++ b/tools/logon.cmd @@ -1,7 +1,9 @@ @echo off set TOOLS=c:\tools -set SETTINGS=%TOOLS%\scripts\settings.cmd -set STATUSFILE=%LOCALAPPDATA%\.user_settings_done +set SCRIPT_SETTINGS=%TOOLS%\scripts\settings.cmd +set COMPANY_SETTINGS=%TOOLS%\company\settings.cmd +set USERCONFIG_DONE=%LOCALAPPDATA%\.user_settings_done +set EMLICENSE_DONE=%LOCALAPPDATA%\.emlicense_done set STARTMENU=%APPDATA%\"Microsoft\Windows\Start Menu\Programs" set STARTMENU_PUBLIC=%PROGRAMDATA%\"Microsoft\Windows\Start Menu\Programs" @@ -15,10 +17,31 @@ set bgcol_R=0 set bgcol_G=0 set bgcol_B=0 -if EXIST %SETTINGS% ( - echo loading settings ... - call %SETTINGS% +rem =================== +rem CONFIGFILE CHECK +rem =================== + +echo searching for SCRIPT settings ... +if NOT EXIST %SCRIPT_SETTINGS% ( + echo INFO: config file %COMPANY_SETTINGS% NOT FOUND + set LANG=en-US +) else ( + echo OK. Loading SCRIPT settings ... + call %SCRIPT_SETTINGS% ) +echo LANG=%LANG% + +set support_user= +set support_password= +set emclient_license=0 +echo searching for COMPANY settings ... +if NOT EXIST %COMPANY_SETTINGS% ( + echo INFO: config file %COMPANY_SETTINGS% NOT FOUND +) else ( + echo OK. Loading COMPANY settings ... + call %COMPANY_SETTINGS% +) + echo setting desktop colour (RGB) ... %TOOLS%\setbgcol %bgcol_R% %bgcol_G% %bgcol_B% @@ -93,7 +116,33 @@ if EXIST %USERPROFILE%\Seafile ( attrib -S %USERPROFILE%\Seafile /S /D ) -if EXIST %STATUSFILE% GOTO END + +rem licensing already done ? +if EXIST %EMLICENSE_DONE% GOTO :USERCONFIG + +echo. +echo ##### +echo ##### LICENSING +echo ##### +echo. + +if %emclient_license% == 0 ( + echo no em Client license found! +) else ( + echo + echo adding em Client license ... + "%ProgramFiles(x86)%\eM Client\MailClient.exe" /activate %emclient_license% + echo. +) + +rem create a statusfile (this block must be executed only once) ... +echo 1 >%EMLICENSE_DONE% + + +:USERCONFIG + +rem already done ? +if EXIST %USERCONFIG_DONE% GOTO END if EXIST %TOOLS%\personal ( echo. @@ -199,17 +248,19 @@ powershell -command %TOOLS%\scripts\disable-networkfeatures.ps1 echo cleaning START menu tiles ... powershell -command %TOOLS%\scripts\cleanup-tiles.ps1 -rem create statusfile (this block must be executed only once) ... -echo 1 >%STATUSFILE% +rem create a statusfile (this block must be executed only once) ... +echo 1 >%USERCONFIG_DONE% :END + echo. echo ##### echo ##### CLEANING ... echo ##### echo. + echo Reorganizing start menu and desktop ... echo ######################################## echo. @@ -260,6 +311,7 @@ rem WARNING! rem DO NOT remove the "PICTURES" folder! rem this is used by the snipping tool! + echo Cleaning users home directory ... echo ######################################## echo. @@ -305,6 +357,7 @@ net config workstation echo ####### %0 ####### + if %ERRORLEVEL% NEQ 0 ( echo # unknown ERROR! # echo ####### %0 #######