Page 1 of 1 1
Topic Options
#1291 - 2000-01-04 10:17 AM Run script based on computername
Anonymous
Unregistered


I currently have a kixstart script that calls the smsls.bat based on the computername of the machine. This creates a huge IF statement and I was hoping someone could give me a better way to do this. The call can not be based on username or group membership because a user may logon to a machine that we don't want SMS on. Here is the current kix file:

? "Hello, @fullname."
? "Welcome to the NT Network" ; display some text strings

color r+/n ; change text to bright red
?
? "It is @time on @month @mdayno, @year."
?
;sleep 2

; This sets default maps for domain users and domain admins.

if ingroup("domain users")
use t: \\server\groups ; map Groups dir
use u: \\server\users ; map Home dir
endif

if ingroup("domain admins") ; Domain Administrators
use n: \\server\install ; map Install dir
use m: \\server\it ; map IT dir
endif

color y+/n ; sets text color to yellow
use list ; lists mapped drives
sleep 1 ; pauses 1 second

color w/n ; change color to white
CLS
color w/n ; change color to white

? "Verifying your computer against database..." ; display
?

if @ras > 0 goto RAS else ; checks if a RAS connection and skips to end
goto MACHINE
endif

:RAS
?
? "You are using a Dial-up connection."
sleep 1
goto end

:MACHINE ; list of computers to manage
if @wksta = "ACCLT1"
or @wksta = "AzuraAC"
or @wksta = "C001"
or @wksta = "C002"
or @wksta = "C003"
or @wksta = "C004"
or @wksta = "C005"
or @wksta = "C006"
or @wksta = "C007"
or @wksta = "C008"
or @wksta = "C009"
or @wksta = "FUJBLM"
or @wksta = "GW2000"
or @wksta = "GW2002"
or @wksta = "GW2004"
or @wksta = "GW2005"
or @wksta = "GW2007"
or @wksta = "GW2008"
or @wksta = "GW2009"
or @wksta = "H001"
or @wksta = "H002"
or @wksta = "H003"
or @wksta = "H004"
or @wksta = "H005"
or @wksta = "H007"
or @wksta = "H008"
or @wksta = "H009"
or @wksta = "H010"
or @wksta = "H011"
or @wksta = "H012"
or @wksta = "H013"
or @wksta = "H014"
or @wksta = "H015"
or @wksta = "H016"
or @wksta = "H017"
or @wksta = "H018"
or @wksta = "H019"
or @wksta = "H020"
or @wksta = "H021"
or @wksta = "H022"
or @wksta = "H023"
or @wksta = "H024"
or @wksta = "H026"
or @wksta = "H027"
or @wksta = "H028"
or @wksta = "H029"
or @wksta = "H030"
or @wksta = "H031"
or @wksta = "H032"
or @wksta = "H033"
or @wksta = "H034"
or @wksta = "H035"
or @wksta = "H036"
or @wksta = "H037"
or @wksta = "H038"
or @wksta = "H039"
or @wksta = "H040"
or @wksta = "H041"
or @wksta = "H042"
or @wksta = "H043"
or @wksta = "H044"
or @wksta = "H045"
or @wksta = "H046"
or @wksta = "H047"
or @wksta = "H048"
or @wksta = "H049"
or @wksta = "H050"
or @wksta = "H051"
or @wksta = "H053"
or @wksta = "H054"
or @wksta = "H055"
or @wksta = "H056"
or @wksta = "H057"
or @wksta = "H058"
or @wksta = "H059"
or @wksta = "H060"
or @wksta = "H061"
or @wksta = "H062"
or @wksta = "H063"
or @wksta = "H064"
or @wksta = "H065"
or @wksta = "H066"
or @wksta = "H067"
or @wksta = "H068"
or @wksta = "H069"
or @wksta = "H070"
or @wksta = "H071"
or @wksta = "H072"
or @wksta = "H073"
or @wksta = "H074"
or @wksta = "IBM001"
or @wksta = "IBMDLB"
or @wksta = "SASPUB"
or @wksta = "TS30LT"
or @wksta = "TS31LT"
or @wksta = "DELLAC"
or @wksta = "DELLLT"
or @wksta = "DIGPC1"
or @wksta = "DE002"
or @wksta = "DE003"
or @wksta = "D002"
or @wksta = "D003"
or @wksta = "D004"
or @wksta = "D005"
or @wksta = "D007"
or @wksta = "D009"
or @wksta = "D010"
or @wksta = "D011"
or @wksta = "D012"
or @wksta = "D013"
or @wksta = "D014"
or @wksta = "D015"
or @wksta = "D016"
or @wksta = "D017"
or @wksta = "D018"
or @wksta = "D019"
or @wksta = "D021"
or @wksta = "D022"
or @wksta = "D023"
or @wksta = "D024"
or @wksta = "D025"
or @wksta = "D027"
or @wksta = "D028"
or @wksta = "D029"
or @wksta = "D030"
or @wksta = "D031"
or @wksta = "D032"
or @wksta = "D033"
or @wksta = "D034"
or @wksta = "D035"
or @wksta = "D036"
or @wksta = "D037"
or @wksta = "D038"
or @wksta = "D039"
or @wksta = "D041"
or @wksta = "D043"
or @wksta = "D044"
or @wksta = "D045"
or @wksta = "D046"
or @wksta = "D047"
or @wksta = "D048"
or @wksta = "D049"
or @wksta = "D050"
or @wksta = "D051"
or @wksta = "D052"
or @wksta = "D052"
or @wksta = "D053"
or @wksta = "D054"
or @wksta = "D055"
or @wksta = "D056"
or @wksta = "D057"
or @wksta = "D058"
or @wksta = "D059"
or @wksta = "D060"
or @wksta = "D061"
or @wksta = "D062"
or @wksta = "D063"
or @wksta = "D064"
or @wksta = "D065"
or @wksta = "D066"
or @wksta = "D067"
or @wksta = "D068"
or @wksta = "D069"
or @wksta = "D070"
or @wksta = "D071"
or @wksta = "D072"
or @wksta = "D073"
or @wksta = "D074"
or @wksta = "D075"
or @wksta = "D076"
or @wksta = "D077"
or @wksta = "D078"
or @wksta = "D079"
or @wksta = "D080"
or @wksta = "D081"
or @wksta = "D082"
or @wksta = "D083"
or @wksta = "D084"
or @wksta = "D085"
or @wksta = "D086"
or @wksta = "D087"
or @wksta = "D088"
or @wksta = "D089"
or @wksta = "D090"
or @wksta = "D091"
or @wksta = "D092"
or @wksta = "D093"
or @wksta = "D094"
or @wksta = "D095"
or @wksta = "D096"
or @wksta = "D097"
or @wksta = "D098"
or @wksta = "D099"
or @wksta = "D102"
or @wksta = "D103"
or @wksta = "D104"
or @wksta = "D105"
or @wksta = "D106"
or @wksta = "D107"
or @wksta = "D108"
or @wksta = "D109"
or @wksta = "D110"
or @wksta = "D111"
or @wksta = "D112"
or @wksta = "D113"
or @wksta = "D114"
or @wksta = "D115"
or @wksta = "D116"
or @wksta = "D117"
or @wksta = "D118"
or @wksta = "D119"
or @wksta = "D120"
or @wksta = "D121"
or @wksta = "D122"
or @wksta = "D123"
or @wksta = "D124"
or @wksta = "D125"
or @wksta = "D126"
or @wksta = "D127"
or @wksta = "D128"
or @wksta = "D129"
or @wksta = "D130"
or @wksta = "D131"
or @wksta = "D132"
or @wksta = "D133"
or @wksta = "D134"
or @wksta = "D135"
or @wksta = "D136"
or @wksta = "D137"
or @wksta = "D138"
or @wksta = "D139"
or @wksta = "D140"
or @wksta = "D141"
or @wksta = "D142"
or @wksta = "D143"
or @wksta = "D144"
or @wksta = "D145"
or @wksta = "D147"
goto SMS else
goto END
endif

:SMS ;runs SMS logon script
shell "%COMSPEC% /e:1024 /c " + "@LSERVER\NETLOGON\SMSLS.BAT"

:END
exit

Top
#1292 - 2000-01-05 12:01 AM Re: Run script based on computername
Anonymous
Unregistered


aharvey,

Perhaps you could place a flag file somewhere
beyond a regular user's area of access and
use an IF statement to check for the
existance of the file to determine whether
or not SMS is run on the PC. This maintains
the requirement of being based on the PC
itself.

Example:

IF EXIST ("%windir%\system32\smsflag.txt")
GOTO "SMS"
ELSE
GOTO "END"
ENDIF

I hope this helps!

------------------

Top
#1293 - 2000-01-04 02:24 PM Re: Run script based on computername
Anonymous
Unregistered


Hi,

Another option is to simply check for the existence of SMS on the local computer in the registry. If it is there, then go ahead and run the SMS script. You would just have to be sure on new computers to manually install SMS the first time on those computers you wish to have SMS manage. I don't remember the SMS keys in the registry off-hand, but you should be able to find some with a simple search.

------------------
Regards,

Brad
Consultant
Net InfraStructure, Inc

Top
#1294 - 2000-01-11 03:02 AM Re: Run script based on computername
Anonymous
Unregistered


you'd bette use the last 3.61 commands
READPROFILESTRING and WRITEPROFILESTRING

place the list of machines you want sms installed to in a file having this structure

[SMS MACHINES]
station1=SMS
station2=SMS

and so on

now you have to read if @wksta is listed in the SMS MACHINES section

example

$rc=READPROFILESTRING($SMSFILE,"SMS MACHINES",@WKSTA)
IF $rc="SMS"
;do SMS job
ENDIF

This will make your script a bit shorter

Consider using
SELECT
CASE @WKSTA="xxxx" GOTO SMS
CASE @WKSTA="xxxx" GOTO SMS
CASE 1 GOTO NOSMS
ENDSELECT

that is more readable than nesting too much OR conditions

Have fun.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.034 seconds in which 0.016 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org