Announcement

Collapse
No announcement yet.

what file extension do you use to save a vb logon script?

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

  • what file extension do you use to save a vb logon script?

    Hey,

    This is a super basic question.

    I'm cutting, pasting, and modifying some vb scripts I got online to ultimately run as a logon script through group policy. I'm pretty new to this and need to know what file extension should I use to save them as in notepad? (.vbs, .exe. cmd, .bat, etc.?)

    Also, if I wanted to test the script out by running it on my computer directly before checking it out though GP on an AD test group, would the file extension need to be different? (For example, if I'm saving it to be used as a logon script through GP, would it be .vbs, but if I'm saving it to double click on and run on my own computer, would it then be .exe?)

    Thanks!
    Gwendolyn

  • #2
    Re: what file extension do you use to save a vb logon script?

    ANSWERED MY OWN QUESION:

    Saving it as a .cmd file worked fine for double clicking and running off my desktop, and I believe that it should work fine in GP.

    NEW QUESTION:

    As a follow up to having answered my own question, when would those other types of file extensions be appropriate? They've always seemed fairly interchangeable to me.

    Gwendolyn

    Comment


    • #3
      Re: what file extension do you use to save a vb logon script?

      Originally posted by sweet_g View Post
      what file extension should I use to save (VBScript) them as in notepad?
      Use .vbs. The extension is associated with VBScript Scripting Host.

      if I wanted to test the script out by running it on my computer ... would the file extension need to be different?
      No, you should use the same extension.

      As a rule of a thumb, change extension only when the file type itself changes. Would it make any sense to rename a .docx as as .xlsx?

      -vP

      Comment


      • #4
        Re: what file extension do you use to save a vb logon script?

        Originally posted by sweet_g View Post
        when would those other types of file extensions be appropriate?
        Windows uses the file extension to figure out what application, if any, should be used to handle opening the file. Whilst renaming a VBScript as .cmd could work, it is a bad practice as you couldn't tell from the file name the type of the file.

        Run Explorer -> Tools -> Folder Options -> File Types to check the registered file types and associations.

        -vP

        Comment


        • #5
          Re: what file extension do you use to save a vb logon script?

          Hey,

          Thanks a lot for the replies, guys.

          Where I am stuck is that I am using the following sample script that I found elsewhere on the forum:

          http://forums.petri.com/showthread.php?t=2431 (the topic is closed)

          The script:

          <package>

          <job id="vbs">

          <script language="VBScript">

          set WshShell = WScript.CreateObject("WScript.Shell")

          strDesktop = WshShell.SpecialFolders("Desktop")

          set oShellLink = WshShell.CreateShortcut(strDesktop & "\Websites.lnk")

          oShellLink.TargetPath = "G:\My4Websites\arehere\websites"

          oShellLink.WindowStyle = 1

          oShellLink.IconLocation = "shell32.dll, 4"

          oShellLink.Description = "Websites"

          oShellLink.Save

          </script>

          </job>

          </package>

          The poster said that he saved it as a .wfs file. When I modify it for my environment
          and save it as .wfs, it does not run. That is either when I double click on
          it to run it on my own computer or try to run it in a GP test group.

          Does anyone have any insight on what the problem might be?

          Thanks,
          Gwendolyn

          Comment


          • #6
            Re: what file extension do you use to save a vb logon script?

            I would delete the first and last three lines and save the remainder as a .vbs file (everything starting with < )
            The sample appears to be either some XML or something to run from a web page
            Tom Jones
            MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
            PhD, MSc, FIAP, MIITT
            IT Trainer / Consultant
            Ossian Ltd
            Scotland

            ** Remember to give credit where credit is due and leave reputation points where appropriate **

            Comment


            • #7
              Re: what file extension do you use to save a vb logon script?

              Originally posted by Ossian View Post
              I would delete the first and last three lines and save the remainder as a .vbs file (everything starting with < )
              The sample appears to be either some XML or something to run from a web page
              Thanks. I just tried that. When I run it on my computer (by double clicking on it) it seems to run but not do anything. Any thoughts?

              Comment


              • #8
                Re: what file extension do you use to save a vb logon script?

                I presume you changed the line:
                oShellLink.TargetPath = "G:\My4Websites\arehere\websites"
                to something valid on your system?

                Havent got an XP box in front of me to test, but will try tomorrow

                Edit -- works fine on Win7x64 with valid path
                Edit red bit:
                Code:
                set WshShell = WScript.CreateObject("WScript.Shell")
                strDesktop = WshShell.SpecialFolders("Desktop")
                set oShellLink = WshShell.CreateShortcut(strDesktop & "\Websites.lnk")
                oShellLink.TargetPath = "D:\Technet"
                oShellLink.WindowStyle = 1
                oShellLink.IconLocation = "shell32.dll, 4"
                oShellLink.Description = "Websites"
                oShellLink.Save
                Last edited by Ossian; 4th May 2010, 19:38.
                Tom Jones
                MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
                PhD, MSc, FIAP, MIITT
                IT Trainer / Consultant
                Ossian Ltd
                Scotland

                ** Remember to give credit where credit is due and leave reputation points where appropriate **

                Comment


                • #9
                  Re: what file extension do you use to save a vb logon script?

                  yes, I had customized it for my system. Getting rid of the stuff at the beginning and end and saving it as a .vbs file took care of the matter. Thanks!

                  Comment

                  Working...
                  X