#149210 - 2005-10-04 09:51 PM
If two values exist
|
plazaai
Fresh Scripter
Registered: 2003-07-25
Posts: 8
|
I need help writing a script. I need to check for membership in a group and a specific reg key. If user belongs to group and reg key does not exist then install exe.
if use is not in group do nothing if user is in group and key exists do nothing
Help Please
|
|
Top
|
|
|
|
#149211 - 2005-10-04 10:01 PM
Re: If two values exist
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Here is an example. You should have the latest version of KiXtart 4.50
Code:
Break On Dim $SO $SO=SetOption('Explicit','On') $SO=SetOption('NoVarsInStrings','On') $SO=SetOption('NoMacrosInStrings','On') If InGroup('MyDomain\MyTestGroup') If Not KeyExist('HKLM\Software\MyKey') SHELL 'NOTEPAD.EXE' EndIf EndIf
|
|
Top
|
|
|
|
#149214 - 2005-10-07 03:38 PM
Re: If two values exist
|
wagsgt
Fresh Scripter
Registered: 2005-10-07
Posts: 5
|
If InGroup ("Group") If Not KeyExist ("HKLM\SOFTWARE\Mykey") run "%logonserver%\netlogon\site\app.exe" endif endif
So this would be correct? It looks at group first then if in group checks for key? But if not in group it skips and doesnt even check for key? BTW the first question was posted for me, Im not "hijacking"
|
|
Top
|
|
|
|
#149216 - 2005-10-07 05:13 PM
Re: If two values exist
|
wagsgt
Fresh Scripter
Registered: 2005-10-07
Posts: 5
|
I believe its v4.2.
|
|
Top
|
|
|
|
#149217 - 2005-10-10 05:18 PM
Re: If two values exist
|
wagsgt
Fresh Scripter
Registered: 2005-10-07
Posts: 5
|
If InGroup ("domain\Group") If Not KeyExist ("HKLM\SOFTWARE\Mykey") run "%logonserver%\netlogon\site\app.exe" endif endif
Hello, After some testing this seems to be working, does anyone see a reason it would not?
Also is there a way after this install, the target computer can create a txt file that shows is succesfully installed?
Thanks again!!
|
|
Top
|
|
|
|
#149218 - 2005-10-10 05:21 PM
Re: If two values exist
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
if not ingroup() if not exist($somefile) run or shell "some app" $=writeprofilestring($somefile,'something','something','something') endif endif
|
|
Top
|
|
|
|
#149219 - 2005-10-10 10:27 PM
Re: If two values exist
|
wagsgt
Fresh Scripter
Registered: 2005-10-07
Posts: 5
|
Sorry was having some trouble understanding last post. I searched around and found the single line below. That seems to create a file that shows me what user and machine ran the install. But I know im skipping some code. Could someone maybe explain a little more in detail?Thanks!
If InGroup ("domain\Group") If Not KeyExist ("HKLM\SOFTWARE\Mykey") run "%logonserver%\netlogon\site\app.exe" WRITEPROFILESTRING("\\server\folder\Installlog.ini","@fullname","@hostname","@date") endif
|
|
Top
|
|
|
|
#149221 - 2005-10-11 02:56 AM
Re: If two values exist
|
wagsgt
Fresh Scripter
Registered: 2005-10-07
Posts: 5
|
Hey NTDOC, The guy that posted this is thread actually posted the first topic for me since I did not know about these forums. Then I got on here also, should I still start a new thread? If so thats not a problem? Thanks!
|
|
Top
|
|
|
|
#149223 - 2005-10-11 03:20 AM
Re: If two values exist
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Code:
If InGroup ("domain\Group") ;Checks if the user is in the specific group, if not then the whole section of ;code is skipped If Not KeyExist ("HKLM\SOFTWARE\Mykey") ;If the key is not found it will launch the application, otherwise it will quit run "%logonserver%\netlogon\site\app.exe" ;WriteProfileString("\\server\folder\Installlog.ini",@fullname,@hostname,@date) ;Need to readup on the WriteProfileString as you can't use it quite like this EndIf EndIf
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 641 anonymous users online.
|
|
|