Solved

script to install msi package remotely in 100 servers

Posted on 2011-09-16
11
3,659 Views
1 Endorsement
Last Modified: 2012-05-12
hi,

i need help to install a package to 100 WINDOWS 2008 SERVERS.

the script must do this from txt file with server list (one per line):

1-copy the msi file from my local c:\package.msi to remote folder c:\install

2-install msi with silent mode

3-remove the c:\install folder

4-get report to be sure for success of installation

5-reboot the server

thanks
1
Comment
Question by:cawasaki
[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
  • 7
  • 4
11 Comments
 

Author Comment

by:cawasaki
ID: 36553832
any help plz?
0
 
LVL 11

Expert Comment

by:marek1712
ID: 36561909
OK. Some questions first:
- is PS configured via GPO (I mean - Execution Policy, ACL, CredSSP, etc)?
- what kind of package is this? Some hotfix or custom program? If latter - how does it report the results? By creating registry entry or some file in %windir% or whatever?
0
 

Author Comment

by:cawasaki
ID: 36562732
hi marek1712,

powershell is installed in all server. no problem to execute powershell remotely, i have many worked script....

the msi package is the trend antivirus, it uninstall the acutal installed antivirus and install the new one.

for the :
4-get report to be sure for success of installation, it can be do bye export the applicaiton event, i have not the exact number of event for succesfull install of trend antivirus but i can give you it.

sorry for my bad english !
0
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!

 

Author Comment

by:cawasaki
ID: 36565673
its very difficult?
0
 
LVL 11

Expert Comment

by:marek1712
ID: 36568437
Well, this script should be easy:
#List of the servers - one per row. No semicolons, etc
$pc_list = Get-Content c:\list.txt
#Loop to get through each server from the list
#In it we'll remote to the machine (Enter-PSSession) and check if the target dir DOESN'T exist.
#If it isn't there - it'll be created.
#Next - the target file will be copied and installed using msiexec (silently, without restart)
#EVERY action will be  recorded in a file specified after /l switch
#Then - the process will quit.
foreach ($pc in $pc_list)
{
    Enter-PSSession -ComputerName $pc
    if (!(Test-Path c:\install)) {New-Item -ItemType Directory -Path C:\install}
    Copy-Item \\server\your_file.msi C:\install
    msiexec /i C:\install\your_file.msi /quiet /norestart /l* \\server\some_path\$pc.log
    Exit-PSSession
}

Open in new window

Beware though - I don't have test environment ATM, so can't really test it out. I'd suggest you to create a VM and use it as a lab for this script.
Also - try to install it manually on one of the machines and check the eventlog then. I can't include events if I don't know what we're looking for ;)
If you have remoting configured then there should be no issues (we don't even have to use CredSSP so it's one possible problem less).

The downside of this script is that it'll perform the actions sequentially - meaning it'll go server by server. The other idea would be to run the script block as a job - it'd perform simultaneously then. Haven't used it yet though ;)
0
 

Author Comment

by:cawasaki
ID: 36568664
OK, i will test this script and report the result in 1 hour

thanks
0
 

Author Comment

by:cawasaki
ID: 36569712
hi,

ok have a problem with enter-pssesison command, i suspect a remote service is off.

i suggest a bat or cmd script with psexec use if you can help me?

the error:

Enter-PSSession : Connecting to remote server failed with the following error m
essage : WinRM cannot process the request. The following error occured while us
ing Kerberos authentication: The network path was not found.
 Possible causes are:
  -The user name or password specified are invalid.
  -Kerberos is used when no authentication method and no user name are specifie
d.
  -Kerberos accepts domain user names, but not local user names.
  -The Service Principal Name (SPN) for the remote computer name and port does
not exist.

thanks for your help
0
 

Author Comment

by:cawasaki
ID: 36569973
for the event,here the information:

application event

event 1033

source: MsiInstaller

thanks
0
 
LVL 11

Accepted Solution

by:
marek1712 earned 500 total points
ID: 36579185
Enable PS Remoting via GPO:
http://blog.powershell.no/2010/03/04/enable-and-configure-windows-powershell-remoting-using-group-policy/
If you want to do this psexec way that badly (make sure firewal isn't blocking it)...
OK - first the installation (you may need to specify DOMAIN\username and password with -u and -p switches):

psexec @computer_list.txt -c \\path\to_the_following.BAT
if not exist c:\install md c:\install
copy \\server\Path_to_file.msi c:\install
msiexec /i c:\install\file.msi /quiet /norestart /l* \\server\some_path\%computername%.log

Open in new window


Then:
 
psloglist @computer_list.txt -i 10 -n 5 Application >> \\server\Path_to_log_file.log

Open in new window

to save results to one log file. It'll save five most recent 1033 events to the common file (as this event is not specific to your AV software some other installation logs may get in the way).
As always /? switch will help you.
0
 
LVL 11

Expert Comment

by:marek1712
ID: 36579188
Meh, it should be:

psloglist @computer_list.txt -i 1033 -n 5 Application >> \\server\Path_to_log_file.log
0
 

Author Comment

by:cawasaki
ID: 36593157
ok i will test this script and report result
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

756 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