Announcement

Collapse
No announcement yet.

Login script containing a message

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Login script containing a message

    hi Guys,


    I was wondering how to write a logon script displaying a warning message of my choosing when clients log in. Something like a pop up they can click away. What would this script look like?


    Thx

  • #2
    Re: Login script containing a message

    Something like the way this LOGOFF message is started here:
    http://forums.petri.com/showthread.php?t=14463

    \Rem

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment


    • #3
      Re: Login script containing a message

      How about using GPO (Interactive logon: Message text for users attempting to log on)?
      take a look at this: http://support.microsoft.com/kb/310430

      Anyway, if you insist on a login script, read a little bit about the MsgBox() function (in VBScript):
      MsgBox(prompt, buttons, title)

      prompt:
      String expression displayed as the message in the dialog box. The maximum length of prompt is approximately 1024 characters, depending on the width of the characters used. If prompt consists of more than one line, you can separate the lines using a carriage return character (Chr(13)), a linefeed character (Chr(10)), or carriage return–linefeed character combination (Chr(13) & Chr(10)) between each line.
      buttons:
      Numeric expression that is the sum of values specifying the number and type of buttons to display, the icon style to use, the identity of the default button, and the modality of the message box. See Settings section for values. If omitted, the default value for buttons is 0.
      title:
      String expression displayed in the title bar of the dialog box. If you omit title, the application name is placed in the title bar.

      The buttons argument settings are:
      0 Display OK button only.
      1 Display OK and Cancel buttons.
      2 Display Abort, Retry, and Ignore buttons.
      3 Display Yes, No, and Cancel buttons.
      4 Display Yes and No buttons.
      5 Display Retry and Cancel buttons.
      16 Display Critical Message icon.
      32 Display Warning Query icon.
      48 Display Warning Message icon.
      64 Display Information Message icon.
      0 First button is default.
      256 Second button is default.
      512 Third button is default.
      768 Fourth button is default.
      0 Application modal; the user must respond to the message box before continuing work in the current application.
      4096 System modal; all applications are suspended until the user responds to the message box.

      Return Values:
      The MsgBox function has the following return values:
      1 The user clicked on the OK button
      2 The user clicked on the Cancel button
      3 The user clicked on the Abort button
      4 The user clicked on the Retry button
      5 The user clicked on the Ignore button
      6 The user clicked on the Yes button
      7 The user clicked on the No button


      Example:
      Code:
      Dim MyVar
      MyVar = MsgBox ("Hello World!", 65, "MsgBox Example")
      'MyVar contains either 1 or 2, depending on which button is clicked.
      Hope it helps,
      Martin77.
      Last edited by martin77; 28th March 2007, 11:51.

      Comment


      • #4
        Re: Login script containing a message

        Yep, and for the buttons- and display-style, you can combine the different types of arguments,
        eg. 48+4096 is my favorite for sending messages to users.

        And it is recommended, when you do want to use a logon-script for the Message text, to run the vbscript by a wscript command line (see also the link in my previous reply):
        In the GPO,
        "scriptname: %SystemRoot%\system32\wscript.exe
        "scriptparameters: //NoLogo //I //T:10 "path\LogonMessage.vbs"
        That's because the complete logon proces will hold till the user pushes the OK or Cancel button to go on. When using the script //parameters you can set the maximum time the script will run. But this command-line will only work with vbs-scripts.

        extra,
        With HTA-scripts you can design much nicer messageboxes.
        When you run a script as computer-startup script, the script will be processed by the systemaccount. With a HTA-messagebox you have the possibility to create check-boxes for the user for instance for options to install programs or change systemsettings (executed by the systemaccount). By example you can create your own 'networkchanger' this way. HTA does not run under the scripthost but you can use: Set objShell=CreateObject("WScript.Shell") in it to 'Run' executables.
        (I tested HTA-scripts as for startup messages, but never tested it to execute files before logon, but Im possitive that it will work)


        \Rem

        This posting is provided "AS IS" with no warranties, and confers no rights.

        __________________

        ** Remember to give credit where credit's due **
        and leave Reputation Points for meaningful posts

        Comment


        • #5
          Re: Login script containing a message

          Hi and thanx, I used the standard template GPO to do this. Thanks for the help.

          Comment

          Working...
          X