Home Mail MemberMap Chat (0) Wallpapers
Go Back   ChiefsPlanet > The Lounge > Media Center

Reply
 
Thread Tools Display Modes
Old 02-08-2013, 08:23 AM  
QuikSsurfer QuikSsurfer is offline
Got swag?
 
QuikSsurfer's Avatar
 
Join Date: Aug 2003
Location: Madison, MS
Casino cash: $108424
Any PowerShell gurus out there?

I've got over 400 windows 2008 R2 servers and I need to install SNMP services and then set the community string and host for it to accept packets from.
Now a few of these servers already have SNMP services installed.. I've put together a PS script to check if SNMP services (a windows feature essentially) is installed -- if it's not, install it - if it is, skip installation and go to deleting the existing strings and creating the new ones.
I've got two local servers here that I'm testing on (both do not have SNMP services installed) and I'm getting the script to run but it fails (says it fails but it actually does install the SNMP services) and doesn't set the community strings UNLESS you run the script a second time. After running the script a second time, all is well..... I've been looking at this for far too long and need another pair of eyes.

And all execution policies are set to RemoteSigned.

Quote:
#Powershell Script To Install SNMP Services (SNMP Service, SNMP WMI Provider)

cls
echo "This script installs and configures SNMP to accept packets from NTOMEAPP and Community Names"
echo "-------------------------------------------------------------------------------------------------------------------------- "

import-module servermanager

#Variables
$pmanagers = "172.17.66.206"
$commstring = '0m$aGr0p3r'

#Import ServerManger Module
Import-Module ServerManager

#Check If SNMP Services Are Already Installed
$check = Get-WindowsFeature | Where-Object {$_.Name -eq "SNMP-Services"}
If ($check.Installed -ne "True") {
#Install/Enable SNMP Services
echo "SNMP not installed"
echo "Installing . ."
Add-WindowsFeature SNMP-Services | Out-Null
}

##Verify Windows Servcies Are Enabled
If ($check.Installed -eq "True"){
# Delete existing values
echo "Deleting existing permitted hosts"
reg DELETE "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers" /va /f

#Set SNMP Permitted Manager(s)
Foreach ($manager in $pmanagers){
echo "Setting permitted managers"
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers" /v 1 /t REG_SZ /d 172.17.66.206 /f | Out-Null

}
#Set SNMP Community String(s)- *Read Only*
Foreach ( $string in $commstring){
echo "Setting READ ONLY PUBLIC as Accepted Community Names"
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\ValidCommunities" /v $string /t REG_DWORD /d 4 /f | Out-Null
}
echo "Restarting/starting SNMP service"
Restart-Service "snmp service"
echo " "
echo "Done!"
}
Else {Write-Host "Error: SNMP Services Not Installed (and failed trying to install)."}
Posts: 11,743
QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.
  Reply With Quote
Old 02-08-2013, 09:09 AM   #2
QuikSsurfer QuikSsurfer is offline
Got swag?
 
QuikSsurfer's Avatar
 

Join Date: Aug 2003
Location: Madison, MS
Casino cash: $108424
I see...
__________________
Posts: 11,743
QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.
  Reply With Quote
Old 02-09-2013, 01:55 PM   #3
Saulbadguy Saulbadguy is offline
When a nightmare becomes real
 
Saulbadguy's Avatar
 

Join Date: Nov 2003
Casino cash: $10150791
That's stupid.

Just get SCOM 2012.
__________________
http://www.goemaw.com
Posts: 46,008
Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.
  Reply With Quote
Old 02-09-2013, 02:19 PM   #4
BigRedChief BigRedChief is offline
Brainwashed
 
BigRedChief's Avatar
 

Join Date: Dec 2003
Location: Swims with fishes
Casino cash: $299580
Powershell is a powerful tool. but, in this case there are better ways to accomplish your goals.
__________________
Quote:
Originally Posted by MTG#10 View Post
I believe Hitler hated Jews and had a lot of them killed. I dont believe it was anywhere close to 6 million though. I'm not an anti-semite; I just think that number has been severely inflated and there is a lot of evidence that supports this belief.
Posts: 42,498
BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.
  Reply With Quote
Old 02-09-2013, 04:18 PM   #5
QuikSsurfer QuikSsurfer is offline
Got swag?
 
QuikSsurfer's Avatar
 

Join Date: Aug 2003
Location: Madison, MS
Casino cash: $108424
Quote:
Originally Posted by Saulbadguy View Post
That's stupid.

Just get SCOM 2012.
**** SCOM. We just moved from SCOM to solarwinds.
SCOM may be the chattiest shitsoftware I've used. It also has nothing to do with what I'm trying to accomplish.. Did you mean SCCM? Because that's what I'm using to push the script out to all the servers.. What can SCOM and its heartbeat monitor/mother role do for me here?

Powershell is fantastic and is absolutely necessary in the MS lineup - especially 2012...

What is the easier route I should be taking to install the windows feature (snmp services) and then set the community string and host? Not a GPO... I can only set the GPO to customize the hosts and strings - I can't install it.
__________________
Posts: 11,743
QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.
  Reply With Quote
Old 02-09-2013, 08:30 PM   #6
Saulbadguy Saulbadguy is offline
When a nightmare becomes real
 
Saulbadguy's Avatar
 

Join Date: Nov 2003
Casino cash: $10150791
Quote:
Originally Posted by QuikSsurfer View Post
**** SCOM. We just moved from SCOM to solarwinds.
SCOM may be the chattiest shitsoftware I've used. It also has nothing to do with what I'm trying to accomplish.. Did you mean SCCM? Because that's what I'm using to push the script out to all the servers.. What can SCOM and its heartbeat monitor/mother role do for me here?

Powershell is fantastic and is absolutely necessary in the MS lineup - especially 2012...

What is the easier route I should be taking to install the windows feature (snmp services) and then set the community string and host? Not a GPO... I can only set the GPO to customize the hosts and strings - I can't install it.
SCOM is chatty as shit unless you configure everything correctly. You can't just install management packs and expect it to work the way you want it to. SNMP isn't going to be nearly as flexible as SCOM. You can even configure SCOM to take corrective actions when an alert is triggered. Log files filling up? Configure SCOM to delete them.

Powershell is awesome. Confirmed.

From looking at your Powershell script, it doesn't seem like it would work if SNMP wasn't already installed.
__________________
http://www.goemaw.com
Posts: 46,008
Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.
  Reply With Quote
Old 02-09-2013, 08:57 PM   #7
BigRedChief BigRedChief is offline
Brainwashed
 
BigRedChief's Avatar
 

Join Date: Dec 2003
Location: Swims with fishes
Casino cash: $299580
Quote:
Originally Posted by Saulbadguy View Post
SCOM is chatty as shit unless you configure everything correctly. You can't just install management packs and expect it to work the way you want it to. .
No shit. People say its shitty but they never configured the alerts correctly. Just install it and it should do everything correctly??

SCOM 2012 is way better than solarwinds. SCOM 2012 can do almost everything solarwinds can do way cheaper and easier to train people on how to admin the tool.
__________________
Quote:
Originally Posted by MTG#10 View Post
I believe Hitler hated Jews and had a lot of them killed. I dont believe it was anywhere close to 6 million though. I'm not an anti-semite; I just think that number has been severely inflated and there is a lot of evidence that supports this belief.
Posts: 42,498
BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.BigRedChief is obviously part of the inner Circle.
  Reply With Quote
Old 02-10-2013, 08:07 AM   #8
QuikSsurfer QuikSsurfer is offline
Got swag?
 
QuikSsurfer's Avatar
 

Join Date: Aug 2003
Location: Madison, MS
Casino cash: $108424
Quote:
Originally Posted by Saulbadguy View Post
SCOM is chatty as shit unless you configure everything correctly. You can't just install management packs and expect it to work the way you want it to. SNMP isn't going to be nearly as flexible as SCOM. You can even configure SCOM to take corrective actions when an alert is triggered. Log files filling up? Configure SCOM to delete them.

Powershell is awesome. Confirmed.

From looking at your Powershell script, it doesn't seem like it would work if SNMP wasn't already installed.
On the script, the where-object is fine. I can get it to install from the script no problem.. The problem is its not configuring the strings in one swoop. I'm having to run the script twice. Once snmp is installed it jumps right to deleting the former reg keys and adding the two that we need.
And again, SCOM will not help us here.. You guys are recommending SCOM to me and you haven't any idea what I'm setting this up for. Its for dell open manage essentials.
And I'll admit our SCOM team (1 guy) was very lazy with his configuration of Alerts - thus my getting over 700 emails a day.. None of which are critical.
SCOM is not the point of this thread... Nor can it do anything that I'm needing to use dell OME for -- updates (hardware), inventory, and warranty status.
__________________
Posts: 11,743
QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.
  Reply With Quote
Old 02-10-2013, 08:13 AM   #9
QuikSsurfer QuikSsurfer is offline
Got swag?
 
QuikSsurfer's Avatar
 

Join Date: Aug 2003
Location: Madison, MS
Casino cash: $108424
Quote:
Originally Posted by BigRedChief View Post
No shit. People say its shitty but they never configured the alerts correctly. Just install it and it should do everything correctly??

SCOM 2012 is way better than solarwinds. SCOM 2012 can do almost everything solarwinds can do way cheaper and easier to train people on how to admin the tool.
I'm not responsible for SCOM.. I didn't set it up and I don't monitor it.. That is handled through our NOC.
We have a massive IT division with various teams.. They've made the decision to abandon SCOM 2007 (even though it is essentially free with our MS contract). I don't make those decisions.
We aren't even looking at SCOM 2012... I just got back a few weeks ago from a 10 day SCCM 2012 class. Apparently, that's the only piece we will be upgrading and migrating to 2012. Aside from the server and AD 2012.

On topic, you don't have any idea about the script in the OP?
__________________
Posts: 11,743
QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.
  Reply With Quote
Old 02-10-2013, 08:29 AM   #10
Saulbadguy Saulbadguy is offline
When a nightmare becomes real
 
Saulbadguy's Avatar
 

Join Date: Nov 2003
Casino cash: $10150791
Quote:
Originally Posted by QuikSsurfer View Post
On the script, the where-object is fine. I can get it to install from the script no problem.. The problem is its not configuring the strings in one swoop. I'm having to run the script twice. Once snmp is installed it jumps right to deleting the former reg keys and adding the two that we need.
And again, SCOM will not help us here.. You guys are recommending SCOM to me and you haven't any idea what I'm setting this up for. Its for dell open manage essentials.
And I'll admit our SCOM team (1 guy) was very lazy with his configuration of Alerts - thus my getting over 700 emails a day.. None of which are critical.
SCOM is not the point of this thread... Nor can it do anything that I'm needing to use dell OME for -- updates (hardware), inventory, and warranty status.
Yea, it doesn't look like the script has anything to do after SNMP is installed if it wasn't already. I'm not a powershell expert though so I dunno.


FYI, Scom has a Dell management pack that can do all of that.
__________________
http://www.goemaw.com
Posts: 46,008
Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.Saulbadguy threw an interception on a screen pass.
  Reply With Quote
Old 02-10-2013, 10:30 AM   #11
QuikSsurfer QuikSsurfer is offline
Got swag?
 
QuikSsurfer's Avatar
 

Join Date: Aug 2003
Location: Madison, MS
Casino cash: $108424
Right on. I didn't look into any dell plugins on SCOM.. I don't believe it will help me in updating bios, firmware, and things relative to chassis CMC's and iDRACs though.
__________________
Posts: 11,743
QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.QuikSsurfer has parlayed a career as a truck driver into debt free trailer and jon boat ownership.
  Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -6. The time now is 08:20 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.