excluding machines in login script...

Posted on 2004-04-14
Last Modified: 2008-02-01
I would like to know the syntax for excluding a machine or a few machines in an IF and or IF...THEN statement in NetWare 6 and 6.5 servers login scripts.

if the machine name does not equal marketing-001 then run this batchfile.
not sure what to use in the %machine spot, on Novell's website they say %machine is for the machine type (?).

Also, if someone has a faster, easier, better way to do this, I am always open to new ideas.

Question by:Ryan Bennett
  • 4
  • 3
  • 3
  • +2
LVL 34

Expert Comment

ID: 10829827
It might be easier to discuss better/faster ways of doing this if you tell us exactly what it is you're trying to accomplish. What does BATCHFILE.BAT do?

Do you have ZENworks?

Expert Comment

by:Trygve Thayer
ID: 10832418
I use Groups to do this.

Add the users to the specific groups.

on your #\\\sys\public\batchfiles\batchfile.bat  I usually use this syntax

#Command /c \\\sys\public\batchfiles\batchfile.bat

IF MEMBER of "Marketing" THEN
    #Command /c \\\sys\public\batchfiles\batchfile.bat
    #Command /c \\\sys\public\batchfiles\batchfile.bat
ELSE IF MEMBER of "Manufacturing" THEN
    #Command /c \\\sys\public\batchfiles\batchfile.bat

Author Comment

by:Ryan Bennett
ID: 10835018
what I am trying to do is run a batch file on some of the machines in 2 of my sites that will merge a .reg file with the registry (or reghack...) to do any number of things in a pinch. I know it's sloppy to do things this way, but sometimes quick and dirty has to be just that when the fix has to be done right now. But I don't want this ran on all of the machines. So I'd like to know if there is a way to exclude by machine name. I could exclude based on a group membership but user's who's machines that I do want this ran on also login to the machines that I don't want this ran on. Also I know that I could use ZEN to do all of this and then some, but my department has been dragging it's feet on it's deployment. So until that's up and running, throwing a batchfile into the login script every now and then works fine.

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

LVL 35

Expert Comment

ID: 10837244

That's so ...  kludgy - so ... Microsoft-ish!

If you want to identify specific machines, then you probably want to do something like the old "mobile user" workaround - set an environment variable identifying each machine uniquely, then check for specific values.

Search this topic, also.  Someone very microsoftish posted a kludgy batch process for something else that is done so elegantly with Zen...

Expert Comment

by:Trygve Thayer
ID: 10837732
Is this a one time thing or something you want based on the user logging in?

Expert Comment

ID: 10862862
%COMPUTERNAME is the variable that you are looking for and yes, you can run commands from a login script utilizing it.


Author Comment

by:Ryan Bennett
ID: 10870073
Sorry Mojo, but %COMPUERNAME did not work I also tried COMPUTERNAME & MACHINE & %MACHINE.

 But as for being Microsoft-ish, that may be. As I said before we are working on deploying ZEN, but I work for a state government that has , for reasons that are beyond me, only one tree (consoleone takes forever to load). One tree for every department. It's simply massive. There has been a few Novell reps that said it's one of, if not the largest tree they have seen use their software in a production environment. So maybe that will tell you why it's taking a while to get our ZEN solution up and running correctly. Sometimes you have to do the quick and dirty.

 This method could also be used for other things besides launching batchfiles, just to simply exclude somethings from in the login script on a machine no matter who logs in to it. Like public access machines, testing machines.

Thanks RBennett
LVL 34

Expert Comment

ID: 10870140

You don't happen to work for the State of NC, do you?

Having one tree is not the issue, unless it is one tree without any partitioning. ConsoleOne may be slow loading, but that's not due to tree size in a properly partitioned environment; its more likely due to a slow machine, or one with not enough RAM, or a lot of Snap-Ins, or some combination thereof.

Accepted Solution

waybadmojo earned 250 total points
ID: 10871843
Here's a special Mojo crib-note for login scripts:

Copy this into your PERSONAL login script (don't do this for an entire container) and you can see whic variables function under your OS.
Turn off the automatic closing of the login script results and ou wil have a nice output page of all the NW login script identifiers and the corresponding output. (Note that some of these work differently on 95/98 than they do under NT/2000/XP).

%COMPUTERNAME is a valid login script identifier under NT/2000/XP. I made the assumption that you would be using AT LEAST Windows NT for your desktops.

WRITE "Access Server                       : %ACCESS_SERVER"
WRITE "Account Balance                  : %ACCOUNT_BALANCE"
WRITE "Administrative Assistant         : %ADMINISTRATIVE_ASSISTANT"
WRITE "Allow Unlimited Credit            : %ALLOW_UNLIMITED_CREDIT"
WRITE "Certificate Validity Interval     : %CERTIFICATE_VALIDITY_INTERVAL"
WRITE "CN (Common Name)             : %CN"
WRITE "Description                           : %DESCRIPTION"
WRITE "E-Mail Address                     : %EMAIL_ADDRESS"
WRITE "ERROR LEVEL                   : %ERROR_LEVEL"
WRITE "Equivalent To Me                : %EQUIVALENT_TO_ME"
WRITE "Fax Number                         : %FACSIMILE_TELEPHONE_NUMBER"
WRITE "File Server                           : %FILE_SERVER"
WRITE "Full Name                            : %FULL_NAME"
WRITE "Generational Qualifier          : %GENERATIONAL_QUALIFIER"
WRITE "Given Name                        : %GIVEN_NAME"
WRITE "Group Membership              : %GROUP_MEMBERSHIP"
WRITE "Higher Privileges                 : %HIGHER_PRIVILEGES"
WRITE "Home directory                    : %HOME_DIRECTORY"
WRITE "Initials                                  : %INITIALS"
WRITE "L (Locality)                           : %L"
WRITE "Language                            : %LANGUAGE"
WRITE "Last Name                           : %LAST_NAME"
WRITE "Locked By Intruder              : %LOCKED_BY_INTRUDER"
WRITE "Login Alias context              : %LOGIN_ALIAS_CONTEXT"
WRITE "Login Context                      : %LOGIN_CONTEXT"
WRITE "Login Disabled                    : %LOGIN_DISABLED"
WRITE "Login Grace Limit                : %LOGIN_GRACE_LIMIT"
WRITE "Login Grace Remaining      : %LOGIN_GRACE_REMAINING"
WRITE "Login Maximum Simultaneous       : %LOGIN_MAXIMUM_SIMULTANEOUS"
WRITE "Login Name                        : %LOGIN_NAME"
WRITE "Machine                             : %MACHINE"
WRITE "Mailbox ID                          : %MAILBOX_ID"
WRITE "Mailbox Location                : %MAILBOX_LOCATION"
WRITE "Mailstop                             : %MAILSTOP"
WRITE "Message Server                 : %MESSAGE_SERVER"
WRITE "Minimum Account Balance          : %MINIMUM_ACCOUNT_BALANCE"
WRITE "Network Address                : %NETWORK"
WRITE "Network address restriction      : %NETWORK_ADDRESS_RESTRICTION"
WRITE "New Mail                            : %NEW_MAIL"
WRITE "Object Class                       : %OBJECT_CLASS"
WRITE "OS                                     : %OS"
WRITE "OS Version                        : %OS_VERSION"
WRITE "OU (Department)               : %OU"
WRITE "Password Allow Change            : %PASSWORD_ALLOW_CHANGE"
WRITE "Password Expires              : %PASSWORD_EXPIRES"
WRITE "Password Minimum Length          : %PASSWORD_MINIMUM_LENGTH"
WRITE "Password Required           : %PASSWORD_REQUIRED"
WRITE "Password Unique required         : %PASSWORD_UNIQUE_REQUIRED"
WRITE "Passwords Used                : %PASSWORDS_USED"
WRITE "Physical Delivery Office Name    : %PHYSICAL_DELIVERY_OFFICE_NAME"
WRITE "Physical Station                 : %P_STATION"
WRITE "Postal Address                   : %POSTAL_ADDRESS"
WRITE "Postal Code                       : %POSTAL_CODE"
WRITE "Postal Office Box               : %POSTAL_OFFICE_BOX"
WRITE "Private Key                        : %PRIVATE_KEY"
WRITE "Profile                                : %PROFILE"
WRITE "Requester Context            : %REQUESTER_CONTEXT"
WRITE "Requester Version            : %REQUESTER_VERSION"
WRITE "Revision                            : %REVISION"
WRITE "S (State)                            : %S"
WRITE "SA (Street Address)           : %SA"
WRITE "Security Equals                 : %SECURITY_EQUALS"
WRITE "Security Flags                   : %SECURITY_FLAGS"
WRITE "See Also                           : %SEE_ALSO"
WRITE "Server Holds                     : %SERVER_HOLDS"
WRITE "Shell Version                     : %SHELL_VERSION"
WRITE "Short machine type           : %SMACHINE"
WRITE "Station                              : %STATION"
WRITE "Supervisor                        : %SUPERVISOR"
WRITE "Surname                           : %SURNAME"
WRITE "Telephone number           : %TELEPHONE_NUMBER"
WRITE "Title                                  : %TITLE"
WRITE "User ID                             : %USER_ID"

Following:  Display Last Login Date and Time also other misc time variables

WRITE "Last Login Time                :%LASTLOGINTIME"
note Lastlogintime works differently with the GUI window 95/98/NT login script use
on a line all by itself instead, Write "%LASTLOGINTIME" will not work.

WRITE "Greeting time                    : %GREETING_TIME"
WRITE "Hours                               : %HOURS"
WRITE "Hour in military                  : %HOUR24"
WRITE "Minutes                            : %MINUTE"
WRITE "Seconds                          : %SECOND"
WRITE "AM OR PM                      : %AM_PM"
WRITE "DAY                                 : %DAY"
WRITE "Day of the week              : %DAY_OF_WEEK"
WRITE "Number of day of the week        : %NDAY_OF_WEEK"
WRITE "Month                              : %MONTH"
WRITE "Name of Month                : %MONTH_NAME"
WRITE "Year by last two digits      : %SHORT_YEAR"
WRITE "Full Year                          : %YEAR"
Following: Display Environment Variables
WRITE "COMSPEC                      : "; <COMSPEC>
WRITE "TZ (Timezone)                : "; <TZ>

LVL 34

Expert Comment

ID: 10872316
mojo, you have WAY too much free time :-)

Expert Comment

ID: 10872996
This is something I created last year for training the guys and gals that work for me..
I find that visual examples like this are the things that they never forget.

Be honest, you liked it :)


Author Comment

by:Ryan Bennett
ID: 10882452

 I'll give it a try!


Author Comment

by:Ryan Bennett
ID: 10912743
That's the one! Everything (and then some) that I needed to know.


Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Groupwise to pst 3 931
Novell Netware servers 3 701
Need help setting up GropWise 2012 on Windows Server 2008R2 10 712
iPrint Error 0x406 12 1,312
The world seems to conceive of a curious bubble separating IT from “the business.”  More so than just about any other pursuit in the commercial world, people think of IT as some kind of an island.
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question