RE: Distributing an Exe file which works locally but fails via SMS



right off the bat I would ask if the user has only "user privs" since you are
accesing Local Machine keys and most users will not have access to them, so
it will fail.
Let me take a look and get back to you on this...

"David Harris" wrote:

The guy that done it sent me this in the email.

Let me know how it goes. I have based the code on the assumption that the
SID will be the second largest key (in length) under HKEY_USERS. I know it is
not a very robust method but (correct me if I am wrong) only one SID can be
loaded at a time (unless you load a hive) and that SID is always the second
largest under HKEY_USERS.

The executable has no output and runs in a fraction of a second.

Ok, I hope this makes sense.

Example HKU value:

reg add
"HKU\S-1-5-21-2073836326-442310520-2068054413-85703\Software\Policies\Mi
crosoft\Windows\System" /v "GroupPolicyMinTransferRate" /t REG_DWORD /d 0 /f

Example HKLM value:

reg add "HKLM\Software\Policies\Microsoft\Windows\System" /v
"GroupPolicyMinTransferRate" /t REG_DWORD /d 0 /f

Ideally this is what the executable would do:

1. Read from registry the SID for the current user that is logged in and
place this in a variable

2. Use this variable to add the first registry value above e.g.

reg add "HKU\VARIABLE\Software\Policies\Microsoft\Windows\System" /v
"GroupPolicyMinTransferRate" /t REG_DWORD /d 0 /f

and also add:

reg add "HKLM\Software\Policies\Microsoft\Windows\System" /v
"GroupPolicyMinTransferRate" /t REG_DWORD /d 0 /f


"Matthew Hudson" wrote:

do you have a list of changes it makes to the registry or is that contained
within the file? If you could send me the files, I can see about possibly
changing it over to a vbscript and seeing if that will work.
What error code is it generating in SMS?
So it is making changes to the local user keys (hkey_current_user) -> this
is mapped from the HKEY_USERS\S-1-5-21-207324453-2039883033-1317461185-1152)
user that is loaded at logon.

"David Harris" wrote:

The executable script file was written by someone else on Technet who needed
to make the same changes and sent me the file.

It is not as simple as using a re file as it looks for the current user in
the reg file (e.g. HKEY_USERS\S-1-5-21-207324453-2039883033-1317461185-1152)
and then changes/adds some reg keys under that which is why it needs to be
run as the user.
It is to fix a Group Policy update problem.

"Matthew Hudson" wrote:

Is is just Registry entries, if so why not just use a Reg file?
Is this a .exe program that you created then? Could you give me some info
on your program and script that you are talking about?

"David Harris" wrote:

It is in a script that runs as an executable.

"Matthew Hudson" wrote:

I have had problems with software packages doing this as well.
are you using regedit.exe /s xxxx.reg to install the registry entries or are
you using a VBScript to install them?



"David Harris" wrote:

The environment tab is set to run 'only when a user is logged in' and therun
mode is 'Run with user's rights'.
The user does have permissions to make the changes in that area of the
registry.
When it is run locally while logged in as the user it works but when pushed
out via SMS it doesn't.

"David Harris" wrote:

I have a exe file that runs a script to put some registry entries in certain
places.
It runs fine when you run it locally on the pc as the user but fails being
pushed from SMS. It must run under user rights and not administrator rights.
I have tried setting it to run from the distribution point and to download to
the pc and then run it.
It still show as Failure under Advertisement Status.
.



Relevant Pages


Loading