I have a custom action that must not be running for the SYSTEM Account.(while deploying thruogh AD).
I tried reading the current UserName with a VBScript(by reading the Environmental Variable - USERNAME) and associating to property used in the CA.

set wshell = createobject("wscript.shell")
strUserName = wshell.ExpandEnvironmentStrings("%USERNAME%")

But this doesn't help as the value gets resolved to (%USERNAME%). On manual Install it works fine.

Is there any in-built property that i can use for the custom action or is there any other way by which i can suppress this CA for the SYSTEM Account ???
0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


hi rayz

just to give you a pointer here

you can run deffered custom actions in user or system content

user content - has the same permissions as the standard user

system content - has elevated privileges

what is your CA for
Answered 04/20/2009 by: cygan
Fifth Degree Brown Belt

Please log in to comment
Ill be nice and tell you a reg key which works to retrieve the currently logged in user when running under the system account ;)

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName


Answered 04/20/2009 by: Inabus
Second Degree Green Belt

Please log in to comment
This custom action checks for a registry in HKCU and aborts installation if not available.(The reason why i don't want it to run for "SYSTEM" account.)

This CA runs at the start of the installation (Immediately after Appsearch). So i don't have an option of using Deferred action.

Answered 04/20/2009 by: rayz_0020
Senior Purple Belt

Please log in to comment
Keep it simple and check for the built-in property 'IsAdmin' or 'Privileged'. One supercedes the other: I can't recall which but I think 'Privileged' is the one to use.
Answered 04/20/2009 by: VBScab
Red Belt

Please log in to comment
check for the built-in property 'IsAdmin' or 'Privileged'
If i am right, this property checks if the current user has the elevated/admin privileges or not...
But my requirement is that i need to know the currently logged-in User's name. And if it is "SYSTEM"(Only for this specific account), i should disable a CA and if not(be it Admins or Standard users), the CA should run. Anything more that i can look-out for ??

PS: Assuming the AD install runs in "SYSTEM" account.....
Answered 04/20/2009 by: rayz_0020
Senior Purple Belt

Please log in to comment

Add the following condition to your CA: If NOT %USERNAME = ""

The USERNAME environment variable is nonexistant/blank when the system account is "logged on" so you can use that as your determining factor. Try it out and see if it does what you need it to do.

Answered 04/20/2009 by: jcarri06
Senior Purple Belt

Please log in to comment
i think the last option is your way forward, the priviledged / admin user properties are not likely to be of any use as your issues seems to stem from running on an account without a profile loaded.

u could also reference the UserSid property which is available during deferred.

if NOT UserSID = "s-5-1-8"
Answered 04/20/2009 by: jmcfadyen
Fifth Degree Black Belt

Please log in to comment