?
Solved

Need help with script

Posted on 2011-03-23
18
Medium Priority
?
540 Views
Last Modified: 2012-05-11
Hello,

 I need assistance creating a script that will work with Windows 7 Pro x86 & x64 (or 2 different for each). I receive new laptops in the company I work for and I have to configure and add them to the domain and install standard applications. I can manually add them to the domain but the app installation process is tedious and time taking, if someone can please help me create a script to perform this task I would greatly appreciated.

for example...there are 3 different locations where the applications resides

\\server1\applications\Norton.exe
\\server2\installations\MSoffice.exe
\\server3\approved\adobeAcrobat.exe

this is an example, but in reality there are about 8 standard application on these servers to be installed per laptop.  

Thanks again!!
0
Comment
Question by:valdezf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 4
  • 2
  • +1
18 Comments
 
LVL 8

Expert Comment

by:ragnarok89
ID: 35201922
Here is what we've used for years to join PCs to the domain:

 
strDomain = "mydomain.LAN"
strUser = "username_with_permission_to_add_PCs_to_domain"
strPassword = "password for user account specified in strUer"


Const JOIN_DOMAIN = 1
Const ACCT_CREATE = 2
Const ACCT_DELETE = 4
Const WIN9X_UPGRADE = 16
Const DOMAIN_JOIN_IF_JOINED = 32
Const JOIN_UNSECURE = 64
Const MACHINE_PASSWORD_PASSED = 128
Const DEFERRED_SPN_SET = 256
Const INSTALL_INVOCATION = 262144


Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName

Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer & "'")

ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, strPassword, strDomain & "\" & strUser, NULL, JOIN_DOMAIN + ACCT_CREATE)

Open in new window


A reboot is required to complete the process.

As for installing your apps, just create a .BAT file that contains
\\server1\applications\Norton.exe
\\server2\installations\MSoffice.exe
\\server3\approved\adobeAcrobat.exe


If I may suggest an option that removes the need for any of this: use an image
0
 

Author Comment

by:valdezf
ID: 35202706
Thanks for the fast response.

How do I write this .bat file? I don't know how to.
0
 
LVL 8

Expert Comment

by:ragnarok89
ID: 35207765
This cannot be used as a .BAT file; save it as a .VBS file.

Run the file from the PC that needs to be joined to the domain.
0
Python: Series & Data Frames With Pandas

Learn the basics of Python’s pandas library of series & data frames and how we can use these tools for data manipulation.

 

Author Comment

by:valdezf
ID: 35208499
but you said that I need to create a .bat file to install the software. forget about adding the laptop to the domain, that's not what I need, I need to create a batch file that would install these applications. Can anyone help me with creating this batch file for windows 7??
0
 
LVL 21

Expert Comment

by:AmazingTech
ID: 35216438
What commands do you currently use to install your applications?

Take the commands you run and put them in a .bat or .cmd file and run it.

Are there any prompts to your application installs?
0
 

Author Comment

by:valdezf
ID: 35218108
there are no prompts when installing these applications. I use a script that was created by my company and it works fine. The only thing I do to install these applications is click the script for that app. for example i would go to the shared drive and click a script, this will install that single application.

my request here is, how can I create 1 .bat file that can automate the installation of all these apps?


0
 

Author Comment

by:valdezf
ID: 35221658
Can someone just point me to the right direction? any tutorials or instructions I can follow on how to create a .bat file for Windows 7?
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 35261602
-Right Click on your desktop
-Click on NEW then Text Document (this will creat the file: New Text Document.txt
-Rename "New Text Document.txt" to: whatever.vbs
-Copy/past the script from ragnarok89 save it's content
-To run it, double click on whatever.vbs

Disclaimer: I dont know if the discussed script will work

You could also google: How install a program with a GPO

There are a lot of other way to install a program on a network PC. Have fun!

Cheers,
Rene
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 35261698
And by the way, it's the same procedure to creat a .bat file. Just call it: whatever.bat

However, if you never created a batch file before, I expect that you also may have trouble managing a server/network. Would it be possible for you to hire an IT professionnal, or you'r stuck and must figure it out by you own?

Cheers,
Rene

0
 

Author Comment

by:valdezf
ID: 35261984
thanks for the comment. I really don't need assistance with adding the laptops to a domain. I ONLY NEED HELP with creating a script (preferably .bat) to install some applications. I know about the extension part, I just don't know how to "write the script" for example

"@ ECHO

net use x:\\server\apps\ms office.exe"
0
 
LVL 21

Expert Comment

by:AmazingTech
ID: 35262113
Don't need net use.

Copy the attached code and try it in a .bat

Change the server names and such to the correct paths.
\\server1\applications\Norton.exe
\\server2\installations\MSoffice.exe
\\server3\approved\adobeAcrobat.exe

Open in new window

0
 
LVL 10

Accepted Solution

by:
ReneGe earned 2000 total points
ID: 35262313
As an example:

This should silently install the program PXCViewer_x86.msi

Assumptions:
-You use a domain controller named DC1
-That you want to install: PXCViewer_x86.msi
-Your logon script is a batch file

Copy "PXCViewer_x86.msi" in you NETLOGON folder

Add to your logon script:
msiexec  /q /i "\\dc1\NETLOGON\PXCViewer_x86.msi"

0
 

Author Comment

by:valdezf
ID: 35262318
this doesn't work. I've already tried it without the net use command. It will not map to the shared drive unless I use the net use command. the problem is that I might need a pause or something in between because the .exe install doesnt work with just net use x:\\server1\applications\norton.exe

0
 

Author Comment

by:valdezf
ID: 35262327
msiexec  /q /i "\\dc1\NETLOGON\PXCViewer_x86.msi" this looks promising. I will try it and post results. thanks!
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 35262351
You can't "net use" a file. But rather a shared folder, as of: net use x: "\\server1\applications"
0
 

Author Comment

by:valdezf
ID: 35262374
yes. I use net use to first map to the shared. this are new laptops so I need to map the shared first than install the applications.
0
 

Author Comment

by:valdezf
ID: 35262572
I found this while trying to use the msiexec. this should help me with the rest. Thanks guys!
Windows ® Installer. V 3.01.4001.5512 

msiexec /Option <Required Parameter> [Optional Parameter]

Install Options
	</package | /i> <Product.msi>
		Installs or configures a product
	/a <Product.msi>
		Administrative install - Installs a product on the network
	/j<u|m> <Product.msi> [/t <Transform List>] [/g <Language ID>]
		Advertises a product - m to all users, u to current user
	</uninstall | /x> <Product.msi | ProductCode>
		Uninstalls the product
Display Options
	/quiet
		Quiet mode, no user interaction
	/passive
		Unattended mode - progress bar only
	/q[n|b|r|f]
		Sets user interface level
		n - No UI
		b - Basic UI
		r - Reduced UI
		f - Full UI (default)
	/help
		Help information
Restart Options
	/norestart
		Do not restart after the installation is complete
	/promptrestart
		Prompts the user for restart if necessary
	/forcerestart
		Always restart the computer after installation
Logging Options
	/l[i|w|e|a|r|u|c|m|o|p|v|x|+|!|*] <LogFile>
		i - Status messages
		w - Nonfatal warnings
		e - All error messages
		a - Start up of actions
		r - Action-specific records
		u - User requests
		c - Initial UI parameters
		m - Out-of-memory or fatal exit information
		o - Out-of-disk-space messages
		p - Terminal properties
		v - Verbose output
		x - Extra debugging information
		+ - Append to existing log file
		! - Flush each line to the log
		* - Log all information, except for v and x options
	/log <LogFile>
		Equivalent of /l* <LogFile>
Update Options
	/update <Update1.msp>[;Update2.msp]
		Applies update(s)
	/uninstall <PatchCodeGuid>[;Update2.msp] /package <Product.msi | ProductCode>
		Remove update(s) for a product
Repair Options
	/f[p|e|c|m|s|o|d|a|u|v] <Product.msi | ProductCode>
		Repairs a product
		p - only if file is missing
		o - if file is missing or an older version is installed (default)
		e - if file is missing or an equal or older version is installed
		d - if file is missing or a different version is installed
		c - if file is missing or checksum does not match the calculated value
		a - forces all files to be reinstalled
		u - all required user-specific registry entries (default)
		m - all required computer-specific registry entries (default)
		s - all existing shortcuts (default)
		v - runs from source and recaches local package
Setting Public Properties
	[PROPERTY=PropertyValue]

Consult the Windows ® Installer SDK for additional documentation on the
command line syntax.

Copyright © Microsoft Corporation. All rights reserved.
Portions of this software are based in part on the work of the Independent JPEG Group.

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Suggested Courses

770 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