Deploying a PowerShell Script or Bat file as a Software Deployment vs a Custom Script

Deploying a PowerShell Script or Bat file as a Software Deployment vs a Custom Script

I'm encountering an issue with a registry export script in Endpoint Central. When I deploy the script as a Software Deployment, it only exports some of the registry subkeys and their values, resulting in a 4KB file. However, when I push the same script as a Custom Script, it exports the specified key along with all its subkeys and values, resulting in a 66KB file. Running the script locally on the machine or from a remote PowerShell prompt also produces the 66KB file.  

Here's the script I'm using:

"@echo off
set OutputFile=C:\temp\HKLM_LogonUI.reg

if exist %OutputFile% (
    del %OutputFile%
    echo Existing file deleted.
)

reg export "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI" %OutputFile% /y

echo Registry export completed."

Installation Command: "powershell.exe -ExecutionPolicy RemoteSigned -File BckupLstLgn.ps1"

Why is the script producing different results depending on how it's deployed? Any insights or suggestions would be greatly appreciated!

Thanks in advance!

                  New to ADSelfService Plus?