#19309 - 2002-04-01 09:56 PM
Re: How do I get rid off error output in my script?
|
Dean B.
Fresh Scripter
Registered: 2002-02-04
Posts: 46
Loc: Allegan, MI USA
|
As Les mentioned, in your script the functions SetTitle(), SetConsole(), Open(), Close(), and WriteLine() all will return values. You need to capture the result in a variable in order to suppress the value printing on the screen.
If you don't mind, I have reposted your script with the following changes:
* Used indentation to make the CASE SELECT and IF statements more readable. * Banished almost all of the GOTO statements and their corresponding labels. * Used Null ($) to capture results of Kixtart functions.
code:
;================================================ ;(Re)Set Ctrl-C/Break handling. ;================================================ BREAK ON ; << If you turn on BREAK, it will allow the user to cancel the login script. ;================================================ ;Setting console window title and making sure ;it is always on top of other windows while open. ;================================================ $ = SetTitle ("School Specialty Login Script") $ = SetConsole ("ALWAYSONTOP") ;================================================ ;Setting Global Variables to be used in the script ;================================================ $NL = Chr(13) + Chr(10) ;================================================ ;Beginning of script... ;================================================ ? "[ Start SSI Login Script... ]" ;================================================ ;Checking for RAS/VPN. RAS/VPN will be greater ;than 0 if it is being used. If true the script ;goes to 'END' and exits without running. ;================================================ :RAS IF (@RAS > 0) ? "[ You are logging in through VPN/RAS... ]" ? "[ The Login Script will exit without running... ]" SLEEP 5 GOTO END ENDIF ;================================================ ;Checking for Citrix System Drives. If found ;script goes to 'END' and Exits without running. ;================================================ :CITRIX IF (%SYSTEMDRIVE% = L:) or (%SYSTEMDRIVE% = M:) or (%SYSTEMDRIVE% = N:) ? "[ You are logging into a Citrix Server... ]" ? "[ The Login Script will exit without running... ]" GOTO END ENDIF ;================================================ ;Greeting the user ;================================================ ? "[ Greetings, @FULLNAME... ]" ? "[ The current Local PC time is ( @TIME )... ]" ;================================================ ;Checking for OS. Run WINSET if Windows 95/98 is ;found. ;[ 1 ] = Windows NT [ 2 ] = Windows 9x ;May not have to use WINSET from now on, since ;KixTart will do all the login functions. ;================================================ IF (@INWIN = 1) ? "[ You are running Windows NT... ]" ELSE ? "[ You are running Windows 95/98... ]" ; ? "Running WINSET for Win95/98." ; SHELL "winset.exe USERNAME=@USERID" ; SHELL "Winset.exe COMPUTERNAME=@WKSTA" ENDIF ;================================================ ;Setting LOGON Server for location and mapping ;drives to LOGON Server. ;================================================ SELECT CASE INGROUP ("Mansfield") $SERVER = "\\MANFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to Users on ( $SERVER )... ]" USE H: "$SERVER\Users" ? "[ Mapping P: to Public on ( $SERVER )... ]" USE P: "$SERVER\Public"
SELECT CASE INGROUP ("Mansfield IT") ? "[ Mapping S: to IT on ( $SERVER )... ]" USE S: "$SERVER\it" CASE INGROUP ("Mansfield SSBIDS") ? "[ Mapping S: to SSBids on ( $SERVER )... ]" USE S: "$SERVER\SSBids" CASE INGROUP ("Mansfield Collections") ? "[ Mapping S: to Collections on ( $SERVER )... ]" USE S: "$SERVER\Collections" CASE INGROUP ("Mansfield PBD") ? "[ Mapping S: to PBD on ( $SERVER )... ]" USE S: "$SERVER\PBD" CASE INGROUP ("Mansfield SSCS") ? "[ Mapping S: to SSCS on ( $SERVER )... ]" USE S: "$SERVER\SSCS" CASE INGROUP ("Mansfield Maintenace") ? "[ Mapping S: to Maintenance on ( $SERVER )... ]" USE S: "$SERVER\Maintenance" CASE INGROUP ("Mansfield Payroll") ? "[ Mapping S: to Payroll on ( $SERVER )... ]" USE S: "$SERVER\Payroll" CASE INGROUP ("Mansfield FE") ? "[ Mapping S: to FE on ( $SERVER )... ]" USE S: "$SERVER\FE" CASE INGROUP ("Mansfield SSHR") ? "[ Mapping R: to SSHR on ( $SERVER )... ]" USE R: "$SERVER\SSHR" CASE INGROUP ("Mansfield Warehouse") ? "[ Mapping S: to Warehouse on ( $SERVER )... ]" USE S: "$SERVER\Warehouse" CASE INGROUP ("Mansfield Frey VM") ? "[ Mapping S: to FREYVM on ( $SERVER )... ]" USE S: "$SERVER\FREYVM" CASE INGROUP ("Mansfield Frey Purch") ? "[ Mapping S: to FREYPURCH on ( $SERVER )... ]" USE S: "$SERVER\FREYPURCH" CASE INGROUP ("Mansfield Frey CS") ? "[ Mapping S: to FreyCS on ( $SERVER )... ]" USE S: "$SERVER\FreyCS" CASE INGROUP ("Mansfield Frey Admin") ? "[ Mapping R: to Freyadmin on ( $SERVER )... ]" USE R: "$SERVER\Freyadmin" CASE INGROUP ("Junebox") ? "[ Mapping H: to Users on ( $SERVER )... ]" USE H: "$SERVER\JUNusers" ? "[ Mapping P: to Public on ( $SERVER )... ]" USE P: "$SERVER\Public" ENDSELECT
IF EXIST ("C:\ETIME\APPS") ? "[ Mapping X: for ETIME... ]" USE X: "$SERVER\ETIME" ENDIF IF EXIST ("C:\CFWY") ? "[ Mappig V: for OmniRate... ]" USE V: "$SERVER\CFOMNIRATE" ENDIF ;================================================ CASE INGROUP ("Appleton") $SERVER = "\\APPFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to Users on ( $SERVER )... ]" USE H: "$SERVER\users" ? "[ Mapping P: to Data on ( $SERVER )... ]" USE P: "$SERVER\Data" ;================================================ CASE INGROUP ("Junebox") $SERVER = "\\APPIIS1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to JUNUsers on ( $SERVER )... ]" USE H: "$SERVER\JUNusers" ? "[ Mapping P: to General on ( $SERVER )... ]" USE P: "$SERVER\General" ;================================================ CASE INGROUP ("Cary") $SERVER = "\\CARBDC1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to Users on ( $SERVER )... ]" USE H: "$SERVER\users" ;================================================ CASE INGROUP ("Cedar Falls") $SERVER = "\\CEDFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to CEDUsers on ( $SERVER )... ]" USE H: "$SERVER\CEDusers" ? "[ Mapping P: to CEDData on ( $SERVER )... ]" USE P: "$SERVER\CEDData" ;================================================ CASE INGROUP ("Fremont") $SERVER= "\\FREFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to FREUsers on ( $SERVER )... ]" USE H: "$SERVER\FREusers" ;================================================ CASE INGROUP ("Fresno") $SERVER = "\\FRSRT1NT" ? "[ Your Logon Server is = ( $SERVER ) ]" ;================================================ CASE INGROUP ("Lyons") $SERVER = "\\LYNFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to LYNUsers on ( $SERVER )... ]" USE H: "$SERVER\LYNusers" ? "[ Mapping P: to LYNPublic on ( $SERVER )... ]" USE P: "$SERVER\LYNPublic" ;================================================ CASE INGROUP ("Ontario") $SERVER = "\\ONTFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to ONTUsers on ( $SERVER )... ]" USE H: "$SERVER\ONTusers" ? "[ Mapping P: to Public on ( $SERVER )... ]" USE P: "$SERVER\Public" ;================================================ CASE INGROUP ("Southeaven") $SERVER = "\\SOUFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to SOUUsers on ( $SERVER )... ]" USE H: "$SERVER\SOUusers" ? "[ Mapping P: to SOUData on ( $SERVER )... ]" USE P: "$SERVER\SOUData" ;================================================ CASE INGROUP ("Sportime") $SERVER = "\\SPTFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to SPTUsers on ( $SERVER )... ]" USE H: "$SERVER\SPTUsers" ? "[ Mapping P: to SPTPublic on ( $SERVER )... ]" USE P: "$SERVER\SPTPublic" ? "[ Mapping S: to SPTDepts on ( $SERVER )... ]" USE S: "$SERVER\SPTDepts" SELECT CASE INGROUP ("SPTkp") ? "[ Mapping K: to SPTAPPS on ( $SERVER )... ]" USE K: "$SERVER\SPTAPPS" ENDSELECT ENDSELECT ;================================================ ;Setting Departmental Drive Mappings... ;================================================ SELECT CASE INGROUP ("Sales Admin") ? "[ Mapping S: to Sales on ( \\appfp1nt )... ]" USE S: "\\appfp1nt\sales" ENDSELECT ;================================================ ;Setting Custom Application Drive Mappings... ;================================================ SELECT CASE INGROUP ("FRX") ? "[ Mapping W: to frx55 on ( \\appsql1nt )... ]" USE W: "\\appsql1nt\frx55" ENDSELECT ;================================================ ;Running AUX Scripts... ;================================================ ? "[ Running AuditWizard Scanner... ]" RUN "\\appcitrix1nt\scanners\netlogon\scan32.exe" ;================================================ ;[ SHELL ] will run the app and the script will ;pause till the app has finnished before ;continuing. ;[ RUN ] will start the app and the script will ;continue without waiting. ;================================================ ;================================================ ;Norton Virus Definition Update ;================================================ ? "[ Checking for AntiVirus Update... ]" $NAVFILE = Dir("$SERVER\netlogon\_auxfiles\*.exe") IF EXIST ("C:\NAV") = 0 MD "C:\NAV" ENDIF IF EXIST ("C:\NAV\$NAVFILE.log") = 0 DEL "C:\NAV\*.log" $ = OPEN(1,"C:\NAV\$NAVFILE.log",5) $ = WRITELINE(1,"Your NAV Definitions were updated with.... " + $NL) $ = WRITELINE(1,"[ $NAVFILE ] at [ @TIME @DATE ]") $ = CLOSE(1) ? "[ Updating AntiVirus with ( $NAVFILE )... ]" RUN "$SERVER\netlogon\_auxfiles\$NAVFILE /q" GOTO END ELSE ? "[ Your AntiVirus Definitions are up to date... ]" ENDIF ;================================================ ;End of Script... ;================================================ :END ? "[ Finish SSI Login Script... ]" + $NL SLEEP 5 ; << Do you really want to make your users wait this long? :) EXIT
Please test this if you are going to use it. I hope this helps!
_________________________
Dean
|
Top
|
|
|
|
#19316 - 2002-04-02 04:53 AM
Re: How do I get rid off error output in my script?
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
Isn't $ a variable ?
-Shawn
I'm just pulling your chain there Jens. I know $= isn't best practice (there are other problems with it as well). Maybe I'm just making excuses for my own terrible coding style [ 02 April 2002, 05:10: Message edited by: Shawn ]
|
Top
|
|
|
|
#19317 - 2002-04-02 05:19 AM
Re: How do I get rid off error output in my script?
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11623
Loc: CA
|
OR maybe you're just trying to raise your post count?
|
Top
|
|
|
|
#19320 - 2002-04-02 07:59 AM
Re: How do I get rid off error output in my script?
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Les,
Let's see here two FAQs.. You are doing good here.
(1) How to suppress results from SETITLE, WRITEPROFILESTRING, WRITELINE, etc.? (2) What makes a good variable, when it is not used, but we still need to supress the results?
Thanks!
- Kent
|
Top
|
|
|
|
#19326 - 2002-04-03 05:45 AM
Re: How do I get rid off error output in my script?
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Les,
You know what? This is in the FAQ...
Check this out:
Debugging without user input..
Later,
- Kent
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 262 anonymous users online.
|
|
|