#201413 - 2011-01-18 12:54 PM
Only run under certain scenario
|
sparkie
Getting the hang of it
Registered: 2010-09-14
Posts: 92
Loc: UK
|
Not sure if this is possible but here goes.
Is there a way to only run something in the script if a user is logging on from a domain PC (XP, Vista or Windows 7) and not a remote domain server (2003/2008) as the same domain user?
Maybe some sort of OS lookup
Thanks
Mark
|
|
Top
|
|
|
|
#201474 - 2011-02-01 12:09 PM
Re: Only run under certain scenario
[Re: Glenn Barnas]
|
sparkie
Getting the hang of it
Registered: 2010-09-14
Posts: 92
Loc: UK
|
Looking at the @PRODUCTTYPE I stumbled accross the function, so would this work since I only what the command to run on XP/Vista domain PC's and not when they login to a remote server session
Function IsNonServer() if not (IsMemberServer() or IsDomainController()) $rc = WriteValue("HKEY_CURRENT_USER\Software.......) else $IsNonServer = 0 endif Endfunction
|
|
Top
|
|
|
|
#201475 - 2011-02-01 02:14 PM
Re: Only run under certain scenario
[Re: sparkie]
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4563
Loc: USA
|
As Glenn suggested, it could be as simple as...
if instr(@producttype,"Server") or instr(@producttype,"Domain Controller")
;exit 0
else
;run the login script
endif
|
|
Top
|
|
|
|
#201503 - 2011-02-07 01:57 PM
Re: Only run under certain scenario
[Re: Allen]
|
sparkie
Getting the hang of it
Registered: 2010-09-14
Posts: 92
Loc: UK
|
Using the exit 0, will that not exit the entire script, or just this part of the script?
|
|
Top
|
|
|
|
#201569 - 2011-02-11 11:37 AM
Re: Only run under certain scenario
[Re: ShaneEP]
|
sparkie
Getting the hang of it
Registered: 2010-09-14
Posts: 92
Loc: UK
|
That's what I thought, if exit is at the top level of the script then exit the entire script, but I don't want it to exit the entire script, I want it to exit if = and do if not =
e.g.
If instr(@producttype,"Server") exit, (otherwise do the next line) run "........" endif
...then continue with the rest of the script.
|
|
Top
|
|
|
|
#201574 - 2011-02-11 04:18 PM
Re: Only run under certain scenario
[Re: Mart]
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
If you find the "Not" logic confusing just use the Else section. You can leave a placeholder comment in the other section - you never know, you might need it in the future.
If InStr(@producttype, "Server")
; Put your Server actions here
Else
; Put your non-Server actions here
EndIf
; The rest of the script continues here
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 978 anonymous users online.
|
|
|