This is something that also has been bothering me for a while, and given the age we live in, needs to be handled accordingly. This would mean no unneeded restriction for the user, including no spaces in the path. One of the ways would be to right after the start, you ensure that the root folder path will be surrounded by quotes, which will be stored in a variable, and then just refer to it everywhere. DISM can handle spaces if done right, there is actually a wrongly name package that has a space in its name, and they never bothered to correct it (due to backward compatibility, I suppose). Either way, I would refrain from using GOTO and just do an EXIT -1 or something after PAUSE. In the well-known error codes you can look up the exit code for invalid path or something, and the you can pass that via EXIT in case you would have a caller program.
Not language neutral. You use findstr to seek one specified string. The whoami output in every language is translated. It will not work out of english isos. I just showed what remains unchanged. And when you run the command whoami just machinename/username are displayed in both cmd or powershell as admin or not. with /ALL SID brings some universal IDs too. But every one is present when command is executed as admin or not. So it doesnt matter to us.
This does not list SYSTEM. SID is "S-1-5-18". PowerShell solution: $(New-Object -TypeName System.Security.Principal.SecurityIdentifier("S-1-5-18") -ErrorAction "Stop").Translate([System.Security.Principal.NTAccount]).Value I will try to find a neutral one.
Yes, and NT AUTHORITY\SYSTEM would say "Ativada" everywhere. This is what I was talking about. The user name is explicit enough, we just need to get there. As a test, replace the NT AUTHORITY\SYSTEM lookup with AUTORIDADE NT\....... and you will see. I have some ideas left but need a little testing. I have a generic lookup that should work, but extracting the value has to be perfectly working.
A little less elegant solution, sadly. Batch language is the definition of "restricted", but I want to make sure it will work on every system. FOR /F "tokens=*" %%i IN ('whoami') DO set THIS_USER=%%i tasklist /fi "pid eq 0" /v /fo list | find /I "\" | find /I "%THIS_USER%" > NUL || start /b "ToolKit - TrustedInstaller" "%~dp0Bin\%Arch%\NSudo.exe" -U:T -P:E %0 && exit 0 Double % is needed for the batch file, as you know. So, process ID 0 is System Idle Process, always, and started by none other than NT AUTHORITY\SYSTEM. I compare the username acquired from whoami to that list output line, which has a "\" character in it (this should be the only one explicitly, but with findstr instead of find you do RegEx). Should be language-neutral as per your request. There could be similar checks done (e.g. accounts running specific services), but this is very explicit as this process must exist, and tasklist command should be available everywhere. The PowerShell command I gave you requires unrestricted execution, which may not be available on many systems if secured well. Please test it, I only have English systems at my disposal currently, but I had a successful test on my end. Whoami /all must show all privileges enabled, and the user name must be NT AUTHORITY\SYSTEM (for the given language) as we discussed. They go hand-in-hand, if you do not have all privileges enabled, you are not this account for sure. Do not use double quotes in the FOR command for whoami - you will get an endless loop for the script calling itself over and over again. Edit: "tokens=*" was needed for the FOR loop to extract text separated by space for the output of whoami
this is the IMCK solution for this: Code: if "%~2" neq "" set "LocalUserProfile=%~2" if "%~3" neq "" set "LocalUserName=%~3" if /I exist "%SystemROOT%\SysWOW64\" ( if /I "%PROCESSOR_ARCHITECTURE%" neq "arm64" set "HostArchitecture=x64" if /I "%PROCESSOR_ARCHITECTURE%" equ "arm64" set "HostArchitecture=arm64" ) >nul 2>&1 if /I not exist "%SystemROOT%\SysWOW64\" ( if /I "%PROCESSOR_ARCHITECTURE%" neq "arm" set "HostArchitecture=x86" if /I "%PROCESSOR_ARCHITECTURE%" neq "x86" set "HostArchitecture=arm" ) >nul 2>&1 if /I "%~1" neq "asTrustedInstaller" if /I exist "%Bin%\%HostArchitecture%\nSudo.exe" ( for /F %%# in ('dir /B /A:-D "%~nx0"') do ("%%~dp#Bin\%HostArchitecture%\nSudo.exe" -U=T -P=E -CurrentDirectory=%%~dp# "%%~f#" "asTrustedInstaller" "%UserProfile%" "%UserName%") ) nSUDO brings problems with environment vars so UserProfile and UserName are passed as args too.
MSMG TOOLKIT has an error when adding languages? Every time it's saying file not found, I downloaded all the packs on the single server terabox I found for build 19041.1, someone experienced this error file not found, when adding language. The error? Or am I just not knowing how to do it? I would like some help without getting mad thanks in advance.
There still plenty alternatives at hand, and everything else will bring more complexity, more lines of code and more dependency, all of which will add up to failure for certain user base. If you feel the need to adjust anything for the Nsudo call, do as you deem necessary, but for me everything was working, even with space in the path structure. I just noticed that whoami output is extracted poorly with the FOR loop, so I am going to adjust the code in the previous post soon. What I dislike the most about batch is that I have to use FOR loop for an elementary operation, which is hardly what it was intended for. Edit: fix done, please test it thoroughly again. Also, you keep referring to IMCK (I thought it was some acronym that I was supposed to know, so I actually googled it), but I have exactly zero experience with it, so cannot add much useful comment, unless you show me explicitly specific things, just like what you showed me now.
IMCK (formely known as Custom Toolkit) is my fork of MSMG Toolkit it is in my signature. From mobile devices we cannot see user signatures.
Yeah, I figured since, but I think I was not logged in at the time when I read that post of yours, so it was also not displayed. Still, I am inexperienced when you are referring to it.
Hi, this is my first post on this forum. Thank you so much for the great work done on this software. You guys are amazing. I have tested the MSMG Toolkit several times, on different versions and it has worked correctly, so I intend to move on to the installation phase on several computers. I want a customized installation, without bloatware (the less junk, the more secure and private), and also with the security updates. I have read the README.txt file, but I am left with a simple question regarding the update. "Integrating or >INSTALLING< Windows updates after the component removal will restore the removed components and this is due to the recent change in Microsoft update mechanism." After Windows 10 22H2 Pro is installed, will the update return the removed components? If yes, then if I do the ISO creation process 12 times a year (1 time a month for Windows Cumulative Update), can I get around the problem, if it exists?
@MSMG, In Compatibility Menu from: Code: if "%C_PrintDialog%" equ "-" set "C_PrintDialog=+" to: Code: set "C_PrintDialog=+"
read my question: its for the third party app packs (you can integrate optional app like firefox, starisback, chrome...and 7zip) , not the embedded 7zip binaries.