Skip to content
⌘ NSIS Forum Archive

Can't execute command as admin on system without UAC

4 posts

Patryk#

Can't execute command as admin on system without UAC

Hello guys,

i have the following problem:

Before my installer will be able to go past the language selection window, it should check whether the UWF (Write Filter) is ON.
I tried executing this command "C:\Windows\System32\uwfmgr.exe get-config > D:\uwfinfo.txt" to get the UWF status in a txt file, but it doesnt work somehow.
(Next i would read line 9 and do a StrCmp/StrContains to check whether its ON or OFF.)
I tried doing so by using multiple ways of executing shell commands (Exec, ExecWait, ExecDos, ...). All didn't work.
Do you have any idea how i can achieve this? I would be very grateful.

Note:
UWF/EWF is only available on Windows Enterprise/Education/IoT Versions
UAC is disabled
Anders#
Just to be clear, pipes and > redirection is a cmd.exe feature, neither Exec nor ExecWait is going to work unless you prefix with "cmd.exe /C". Or use nsExec...
Patryk#
Hey Anders, thanks for your help.
Sorry for not replying earlier.
I found another way to solving my problem. I found some flags in the registry which show me the current UWF/EWF status.
So i read the values using ReadRegDWORD and then a simple IntCmp.

EWF (<=Win7): HKLM "System\CurrentControlSet\Services\uwvol\Parameters\Static\Copy0" "Enabled"
UWF (>=Win10): HKLM "System\CurrentControlSet\Services\uwfvol\Parameters\Static" "CurrentSettings"