Good morning/afternoon all,
I hoping someone can assist with this odd issue I am seeing in NSIS. I have a Powershell script that I am attempting to wrap in NSIS. This script modifies the local group policy via updating the Registry.pol file in C:\Windows\System32\GroupPolicy\Machine. Running this script via right click run as admin on the source bat file works fine.
However whenever a bat file is called in NSIS, even though the bat file has administrator, it cannot even see the Machine folder.
To test the permissions I am now wrapping a simple bat file to call a cmd window so I can play around in the NSIS permissions, if I go to the GroupPolicy folder and run a dir I get this:
C:\Windows\System32\GroupPolicy>dir
Directory of C:\Windows\System32\GroupPolicy
12/08/2016 05:27 PM <DIR> .
12/08/2016 05:27 PM <DIR> ..
12/08/2016 05:27 PM 11 gpt.ini
1 File(s) 11 bytes
2 Dir(s) 732,180,004,864 bytes free
I am running this RequestExecutionLevel admin set, and have verifed that the cmd window and the ps window are both elevated.
In nsis I run this command to call the bat: ExecWait '"$INSTDIR\Test.bat" ' $0
The bat file contains this:
CD %~dp0
call cmd.exe
Really unsure what to do next.
Thanks in advanced to anyone that could lend some insight, or even just wild conjecture as to why that folder
NSIS Permissions and System32
4 posts
My guess is that this is a 64-bit system? If it is you are probably running into the file-system redirector.
What happens if you do:
(I don't recommend this usage in an actual installer but testing it is fine)
What happens if you do:
!include x64.nsh?
Section
${DisableX64FSRedirection}
ExecWait '"$InstDir\Test.bat"' $0
${EnableX64FSRedirection}
SectionEnd
(I don't recommend this usage in an actual installer but testing it is fine)
Success! that was it!
Doing a dir on the folder now with the redirection disabled reveals the full folder list.
I imagine the path forward would be messing with the %windir% variable. Any quick suggestions would be appreciate, but thank you again for figuring out whats going on!
Doing a dir on the folder now with the redirection disabled reveals the full folder list.
I imagine the path forward would be messing with the %windir% variable. Any quick suggestions would be appreciate, but thank you again for figuring out whats going on!
%windir% will not change anything, in a 32-bit app the System32 folder is redirected to SysWow64.
You can get to the real System32 folder on Vista+ with %windir%\SysNative but you need to make sure you are on a 64-bit system because that folder does not exist on 32-bit Windows.
You can get to the real System32 folder on Vista+ with %windir%\SysNative but you need to make sure you are on a 64-bit system because that folder does not exist on 32-bit Windows.