Software Update question - new thread for Tim

(imported topic written by brolly3391)

I feel dumb…but this still doesn’t work for me. I’ve tried quite a few different things with no luck. At the moment, I use a .bat file to copy three files to a new directory on the C: drive (another .bat file and 2 supporting files). I then download and execute “RunAscurrentuser.exe” and tell it to execute the .bat file. No luck. Doesn’t even appear to run, but no errors.

I have to copy/edit two files that happen to sit under each users “documents and settings” folder so I have to detect who the user is to copy correctly. Below is my action script and the .bat file.

download http://server.thatplace.com:52311/Uploa … /big28.tmp
continue if { (size of it = 36350 and sha1 of it = “2984dfdfa1c4d2d79d28d2a311f61faf7f6fe4a3”) of file “big28.tmp” of folder “__Download”}
extract big28.tmp
wait “{pathname of system folder & “\cmd.exe”}” /C “{(pathname of client folder of current site) & “__Download\preupd.bat”}”

download http://support.bigfix.com/download/bes/ \u2026 ntUser.exe
continue if {(size of it = 69632 AND sha1 of it = “9bf587d2d4a81e1d8c179ade6a4daf64daa0db31”) of file “RunAsCurrentUser.exe” of folder “__Download”}
wait __Download/RunAsCurrentUser.exe --w cmd.exe /C c:\jdeupdate\jdeupd.bat /change
The .bat file looks like this:

cd c:\jdeupdate
type jdeupd.txt >> c:\Docume~1%USERNAME%\Applic~1\ICAClient\APPSRV.ini
copy Peoplesoft.lnk c:\Docume~1%USERNAME%\Desktop\Peoplesoft.lnk

Things work fine if I change the %USERNAME% variable to a real username (but that obviously won’t work for 1000 people).

Any help is appreciated as I need to provide an answer Monday morning.

Thanks,
Tim

Tim,

It does not look like you are trying to do anything that requires you to run as user. Let’s avoid the issue and change things around just a little to use relevance to get the name of your current user instead of using an environment variable in your bat file. I suspect that your preupd.bat is probably the source of the issue that you are running into.

relevance:

exists current user AND (other stuff)

action:

download http://server.thatplace.com:52311/Uploa … /big28.tmp

continue if { (size of it = 36350 and sha1 of it = “2984dfdfa1c4d2d79d28d2a311f61faf7f6fe4a3”) of file “big28.tmp” of folder “__Download”}

extract big28.tmp

dos type __Download\jdeupd.txt >>“c:\Documents and settings{name of current user}\Application data\ICAClient\APPSRV.ini”

delete “c:\Documents and settings{name of current user}\Desktop\Peoplesoft.lnk”

copy __Download\Peoplesoft.lnk “c:\Documents and settings{name of current user}\Desktop\Peoplesoft.lnk”

That should take care of your update for the currently logged on user. You might run into issues using type>> to update that ini file as it’s easy to end up with duplicate entries and headings by appending to what is there already. But, I don’t really have a better way to perform an .ini file edit using action language or getting really convoluted in a bat file.

(imported comment written by SystemAdmin)

Thanks for the help Brolly33.

I actually did nearly the exact same thing very late last night (after 20 minutes of banging my head because I was using parentheses and not curly braces :slight_smile: The only difference is that I’m not deleting the Peoplesoft.lnk file like you are (they never had the Peoplesoft.lnk file on their desktop anyways).

Then I’m just copying a file out to there machine and adding a relevance clause that says not to be relevant again if the file exists. We did test the duplicate entries in the .ini file and things still work, but you are right in that could get messy quickly.

I’m still confused/disappointed with the RunAsCurrentUser.exe though (as I’m sure the day will come when I’ll need it). For fun, I added a new task last night with this:

download http://support.bigfix.com/download/bes/ \u2026 ntUser.exe

continue if {(size of it = 69632 AND sha1 of it = “9bf587d2d4a81e1d8c179ade6a4daf64daa0db31”) of file “RunAsCurrentUser.exe” of folder “__Download”}

wait __Download/RunAsCurrentUser.exe --w cmd.exe /C calc.exe /change

Nothing happened on the target machine?

Thanks for all your help.

Tim

(imported comment written by brolly3391)

Tim,

I tossed that delete in just in case the file already existed. I am happy to hear you got your fixlet working.

As far as RunAsCurrentUser.exe goes, I know that it does indeed work.

Try this action script to launch calc.exe.

download http://support.bigfix.com/download/bes/util/RunAsCurrentUser.exe

continue if {(size of it = 69632 AND sha1 of it = “9bf587d2d4a81e1d8c179ade6a4daf64daa0db31”) of file “RunAsCurrentUser.exe” of folder “__Download”}

wait __Download/RunAsCurrentUser.exe calc.exe

Then check in task manager to insure that calc.exe is running under the logged on user’s context.

In contrast, this action script should launch calc.exe in the system context, which will not be visible until you check task manager.

wait calc.exe

Cheers,

Brolly

(imported comment written by Doug_Coburn)

Tim,

If your copying and pasting verbatim it looks like you have the short version of

http://support.bigfix.com/download/bes/util/RunAsCurrentUser.exe

or “http://support.bigfix.com/download/bes/util/RunAsCurrentUser.exe”. The forum when you use the url command to make a url clickable shortens the full URL. So if you want to copy and paste out of the post with the example for RunAsCurrentUser then you will need to also make sure that you replace the short form of the url with the full one.

Your url that you posted is showing as http://support.bigfix.com/download/bes/ \u2026 ntUser.exe to me.

Doug

(imported comment written by Veneficus)

The problem with RunAsCurrentUser.exe is that you guys keep giving examples with “–w” switch that does NOT work. Without that switch everything is fine.

(imported comment written by BenKus)

Hey Veneficus,

Yes. You are correct that the version of RunAsCurrentUser.exe (RACU) we posted was an older version that didn’t support the “–w” option. Here is the newer version:

http://software.bigfix.com/download/bes/util/RunAsCurrentUser-1.1.exe

Sorry about that,

Ben

(imported comment written by SystemAdmin)

The default link:

http://support.bigfix.com/download/bes/ … ntUser.exe

Has been updated with the new version as well. You may need to update your sha1 checks for it.

continue if {(size of it = 131072 and sha1 of it = “9fd47b14aee681a6bad6579d30d6fb3fa4cc3ae3”) of file “RunAsCurrentUser.exe” of folder “__Download”}