Home Discord Chat
Go Back   ChiefsPlanet > Nzoner's Game Room > Media Center

Reply
 
Thread Tools Display Modes
Old 02-08-2013, 09:23 AM  
QuikSsurfer QuikSsurfer is offline
Got swag?
 
QuikSsurfer's Avatar
 
Join Date: Aug 2003
Location: Madison, MS
Casino cash: $10008287
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,847
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, 10:09 AM   #2
QuikSsurfer QuikSsurfer is offline
Got swag?
 
QuikSsurfer's Avatar
 

Join Date: Aug 2003
Location: Madison, MS
Casino cash: $10008287
I see...
__________________
Posts: 11,847
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, 02:55 PM   #3
Saulbadguy Saulbadguy is offline
When a nightmare becomes real
 
Saulbadguy's Avatar
 

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

Just get SCOM 2012.
__________________
http://www.goemaw.com
Posts: 46,964
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, 03:19 PM   #4
BigRedChief BigRedChief is online now
Has a particular set of skills
 
BigRedChief's Avatar
 

Join Date: Dec 2003
Location: On the water
Casino cash: $3259627
VARSITY
Powershell is a powerful tool. but, in this case there are better ways to accomplish your goals.
__________________
Fear leads to anger, anger leads to hate, hate leads to suffering.
-YODA
Posts: 78,917
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, 05:18 PM   #5
QuikSsurfer QuikSsurfer is offline
Got swag?
 
QuikSsurfer's Avatar
 

Join Date: Aug 2003
Location: Madison, MS
Casino cash: $10008287
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,847
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, 09:30 PM   #6
Saulbadguy Saulbadguy is offline
When a nightmare becomes real
 
Saulbadguy's Avatar
 

Join Date: Nov 2003
Casino cash: $2726966
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,964
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, 09:57 PM   #7
BigRedChief BigRedChief is online now
Has a particular set of skills
 
BigRedChief's Avatar
 

Join Date: Dec 2003
Location: On the water
Casino cash: $3259627
VARSITY
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.
__________________
Fear leads to anger, anger leads to hate, hate leads to suffering.
-YODA
Posts: 78,917
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, 09:07 AM   #8
QuikSsurfer QuikSsurfer is offline
Got swag?
 
QuikSsurfer's Avatar
 

Join Date: Aug 2003
Location: Madison, MS
Casino cash: $10008287
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,847
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, 09:13 AM   #9
QuikSsurfer QuikSsurfer is offline
Got swag?
 
QuikSsurfer's Avatar
 

Join Date: Aug 2003
Location: Madison, MS
Casino cash: $10008287
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,847
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, 09:29 AM   #10
Saulbadguy Saulbadguy is offline
When a nightmare becomes real
 
Saulbadguy's Avatar
 

Join Date: Nov 2003
Casino cash: $2726966
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,964
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, 11:30 AM   #11
QuikSsurfer QuikSsurfer is offline
Got swag?
 
QuikSsurfer's Avatar
 

Join Date: Aug 2003
Location: Madison, MS
Casino cash: $10008287
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,847
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 10:30 PM.


This is a test for a client's site.
Fort Worth Texas Process Servers
Covering Arlington, Fort Worth, Grand Prairie and surrounding communities.
Tarrant County, Texas and Johnson County, Texas.
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2024, vBulletin Solutions, Inc.