The following command is successful when logged in locally and run as admin at the desktop - it is also successful when running as NT Authority\System via psexec -i -s cmd.exe - the registry key is found and the variables get set correctly
For /F "Tokens=3 delims= " %%i IN ('REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\LCC\DEVICE ^| findstr "Behavior"') Do (
Set "SearchFile=%~dp0cleanupSearch.%%i.txt"
set "excludeFile=%~dp0cleanupExclusion.%%i.txt"
)
When I put it in a package and set it to run whether or not someone is logged in and check "allow users to interact", I see that the registry key is not found.
Unchecking the box "allow users to interact" also results in failure... -- I added a whoami command to the script and confirmed that in this condition it runs as nt authority\system!
Running as the logged in user via sccm also fails to find the registry key... but running the command manually at the desktop as the logged in user is successful.
Is sccm somehow blocked from reading HKLM???? I am seriously confused. Anyone know what I'm doing wrong?
For /F "Tokens=3 delims= " %%i IN ('REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\LCC\DEVICE ^| findstr "Behavior"') Do (
Set "SearchFile=%~dp0cleanupSearch.%%i.txt"
set "excludeFile=%~dp0cleanupExclusion.%%i.txt"
)
When I put it in a package and set it to run whether or not someone is logged in and check "allow users to interact", I see that the registry key is not found.
Unchecking the box "allow users to interact" also results in failure... -- I added a whoami command to the script and confirmed that in this condition it runs as nt authority\system!
Running as the logged in user via sccm also fails to find the registry key... but running the command manually at the desktop as the logged in user is successful.
Is sccm somehow blocked from reading HKLM???? I am seriously confused. Anyone know what I'm doing wrong?