How to Create an Install Script

Installation through Microsoft scripts is used by administrators who oversee several client and server computers on a network. A script is distributed to client computers and run on the machine the next time a user boots the computer. Installation scripts are .vbs files that are placed on the computer's startup directory. They can be local installations, or an administrator can create remote installations over the network. Programming an installation script only takes a few lines of code.

Instructions

  1. Install an Application from the Network

    • 1

      Instantiate the object that sets up security. To use the network, this object is needed to supply the user credentials.
      Set credentials = CreateObject("WbemScripting.SWbemLocator")

    • 2

      Create the credentials and assign them to a connection object.
      Set con = credentials.ConnectServer ("ApplicationServer", "apps\install_directory", "domain\adminUsername", "myPass", , "kerberos:ApplicationServer")
      con.Security_.ImpersonationLevel = wbemImpersonationLevelDelegate

    • 3

      Instantiate the installation class. Set the install call to an error variable. The error variable alerts you to any installations that failed on the network.
      Set inst = con.Get("Win32_Product")
      myErr = inst.Install("\\server\installs\myInstall.msi",,True)

    • 4

      Save this file with a .vbs extension. Place this file in the client "Startup" folder on the hard drive. You can also push these files using login scripts on the server.

    Install an Application from the Local Computer

    • 5

      Instantiate the install service class.
      Set install = GetObject("winmgmts:")

    • 6

      Instantiate the software class. This class indicates the type of installation.
      Set software = install.Get("Win32_Product")

    • 7

      Call the installation method and set the return value to an error variable.
      install_error = software.Install("c:\files\officeinstall.msi", , True)

    • 8

      Save this file with a .vbs extension and place it in the user's "Startup" directory.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured