Remote install of NSClient++ via Batch/PowerShell

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Remote install of NSClient++ via Batch/PowerShell

Post by neworderfac33 »

Good morning,

I now have to deploy NSClient++ to around 500 servers.

We don't have SCCM here - has anyone on the forum ever come up with a working Batch/PowerShell script to carry out a remote install?

Thanks in advance

Pete
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Remote install of NSClient++ via Batch/PowerShell

Post by hsmith »

Hi Pete,

Here is a snippet from our customer support forums. @WillemDH wrote this, and it is pretty neat. I personally have zero experience testing it, but Willem is usually doing some pretty cool stuff.
WillemDH wrote:Hello,

I'm using this NAF action to install NSCLient and NxLog on 600 Windows Servers:

http://outsideit.net/naf-request-install/

And this one to update the NSCLient++ scripts folder.

http://outsideit.net/naf-update-nsclien ... ts-folder/

If you would use these scripts, the only thing you would still need is a script to put the correct nsclient.ini file in place. (as I can"t publish mine as it contains too many sensitive code)

Grtz

Willem
Former Nagios Employee.
me.
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Re: Remote install of NSClient++ via Batch/PowerShell

Post by neworderfac33 »

I'll give it a look - thank you!

I got as far as writing a PowerShell script to copy the msi file onto all the servers in question.

It doesn't actually do the installation, but at least it gets the file onto each machine without me having to:

Log onto each machine
Map to a central software repository
Copy the .msi file over

So it's a start!

Pete
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Remote install of NSClient++ via Batch/PowerShell

Post by WillemDH »

Peter,

Give my scripts a try. They should make you happy.

Grtz

Willem
Nagios XI 5.8.1
https://outsideit.net
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Remote install of NSClient++ via Batch/PowerShell

Post by hsmith »

Thanks for all of your hard work, Willem.

Pete, let us know if there's anything we can do to assist.
Former Nagios Employee.
me.
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Re: Remote install of NSClient++ via Batch/PowerShell

Post by neworderfac33 »

Good morning!

Here's where I am so far, and both versions appear to work on their respective platforms:

Win32:

Code: Select all

msiexec /l* log.txt /i NSCP-0.4.0.169-win32.msi CONF_CAN_CHANGE="TRUE" ALLOWED_HOSTS="99.99.99.99" CONF_CHECKS="TRUE" CONF_NSCLIENT="TRUE" /quiet
Win64:

Code: Select all

msiexec /l* log.txt /i NSCP-0.4.3.143-x64.msi CONF_CAN_CHANGE="TRUE" ALLOWED_HOSTS="99.99.99.99" NSCLIENT_PWD="" CONF_CHECKS="TRUE" CONF_NSCLIENT="TRUE" /quiet
Note that since the Win64 version of the installer suggests a default password during the installation (whereas the Win32 version doesn't), you need to set the value to to "".

Just thought these might help someone!

Pete
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Remote install of NSClient++ via Batch/PowerShell

Post by tgriep »

Thanks for the feedback.
Be sure to check out our Knowledgebase for helpful articles and solutions!
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Re: Remote install of NSClient++ via Batch/PowerShell

Post by neworderfac33 »

Actually, I'm now having some difficulty with the Win32 version of this - all servers where I used the MSIEXEC silent install come up with "Connection Refused".

If, however, I log onto the remote server, manually uninstall and reinstall (using the .msi file within Explorer, as somebody kindly disabled "Add/Remove Programs"!), everything works fine.

Post installation, my script also overwrites the nsclient.ini file with an ini file containing the correct settings, taken from a server on which a manual installation was carried out.

Any pointers as to a command line to uninstall, prior to installing, within my PowerShell script would be most appreciated, otherwise, I'm going to have to manually log onto 200+ Win32 servers, uninstall and reinstall... dear God, no...

Thanks in advance

Pete
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Remote install of NSClient++ via Batch/PowerShell

Post by tmcdonald »

Starting to drift a bit outside of our support scope, but some quick Googling:

http://stackoverflow.com/questions/1135 ... powershell

I am not a big PS guy so I can't give any first-hand advice.
Former Nagios employee
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Re: Remote install of NSClient++ via Batch/PowerShell

Post by neworderfac33 »

Good afternoon,

I finally worked out that it's a problem with the 32 bit client that means that MSIEXEC silent install doesn't work properly - it DOES install, but the resulting client doesn't work, even if you copy a valid settings file from a working server over the top of the one that's just been installed.

The Install of the 64 bit client on Win2008 and Win2012 servers works fine.

And yes, I DID end up having to manually log into 107 Win 2003 servers, uninstall and reistall..!

Deep joy.

This thread can now be closed.

Thanks

Pete
Locked