-v1.1 scripts\registry\regown.cmd issue with reg keys containing a space & SetAcl.exe setowner on non EN Win
Issue #7
resolved
Hi Matthew,
If you have a look in the logfile made by regown.cmd, you will noticed that the reg keys which contain a space have been not processed correctly, as the "FOR /F" by default will split the line of argument at the space. By adding the "tokens=*" the whole line will be processed as intended.
Also here is the issue with setting owner using SetAcl.exe on non EN windows.
Here is my diff for the scripts\registry\regown.cmd
#!
@@ -9,6 +9,6 @@
ECHO * Fixing registry key ownership ...
@REM Loop through list of registry keys and change their owner
-FOR /F %%k IN ('TYPE "%KEYFILE%"') DO (
- reg query "%%k" >nul 2>&1 && "%SETACLBIN%" -on "%%k" -ot reg -actn setowner -ownr n:administrators >> "%LOGFILE%" 2>&1
+FOR /F "tokens=*" %%k IN ('TYPE "%KEYFILE%"') DO (
+ reg query "%%k" >nul 2>&1 && "%SETACLBIN%" -on "%%k" -ot reg -actn setowner -ownr "n:S-1-5-32-544" >> "%LOGFILE%" 2>&1
IF %ERRORLEVEL% NEQ 0 DO SET /A ANCERRLVL=ANCERRLVL+1
@@ -14,5 +14,5 @@
IF %ERRORLEVEL% NEQ 0 DO SET /A ANCERRLVL=ANCERRLVL+1
- reg query "%%k" >nul 2>&1 && "%SETACLBIN%" -on "%%k" -ot reg -actn ace -ace "n:administrators;p:full" >> "%LOGFILE%" 2>&1
+ reg query "%%k" >nul 2>&1 && "%SETACLBIN%" -on "%%k" -ot reg -actn ace -ace "n:S-1-5-32-544;p:full" >> "%LOGFILE%" 2>&1
IF %ERRORLEVEL% NEQ 0 DO SET /A ANCERRLVL=ANCERRLVL+1
)
CU Scalar
Comments (2)
-
-
- changed status to resolved
BUGFIX
#6: disablewinx.cmd setacl setowner issue on non EN Win-installations BUGFIX#7: regown.cmd issue with reg keys containing a space & SetAcl.exe setowner on non EN Win Modified hosts blocking scripts to avoid hosts file locking reviewed hostsip and hostsdns lists→ <<cset b8aee5c5972a>>
- Log in to comment
Good catch. I'll add these changes to v1.2