Posts Tagged ‘OpsMgr’

Mini How-To: practical method to install OpsMgr ( SCOM) agents on all Hyper-V guest managed by SC VVM ( System Center Virtual Machine Manager)

SCVMM 2008 R2 Интеграция с SCOM 2007 R2 « ИТ Блог Алексея Максимова

12.Установка агентов SCOM на сервер VMM, все хосты виртуализации и все виртуальные машины

На этом этапе мы должны обеспечить наличие агента SCOM на всех объектах, которые подпадают под инфраструктуру VMM, а именно:

•На сервере VMM
•На всех серверах несущих роль VMM Library Server
•На всех серверах виртуализации с ролью Hyper-V
•На всех виртуальных машинах

Учетная запись «Action Account» SCOM на время установки агентов должна быть с правами «Local Admin»; проще всего этого добиться включив в группу «Domain Admin».
Перезапустить сервисы или сервер с OpsMgr.

Solution:


# Filename: Install-Agent_VMMComputers-Get-VM-_for_YoureSCVMM.ps1
# Description: Adds System Center Virtual Machine Manager host servers,
# ( and may be library servers ) and all guest to the set of computers
# managed by System Center Operations Manager and install OpsMgr agents.
#
#[ Victor Miasnikov:
#
# 1) Filter Hyper-V guest without Windows ( or other issue ) by "Unknown" :
# if ( -not ( $Computer.ComputerNameString -eq "Unknown" ) ) {
#
# 2) Using $Computer.ComputerNameString as current full DNS Name of computer for install agents, etc. :
# . . . New-WindowsDiscoveryConfiguration -ComputerName $Computer.ComputerNameString
#
#]

#[ Based:
# Filename: DiscoverVMMComputers.ps1.ps1
# Description: Adds System Center Virtual Machine Manager host servers
# and library servers to the set of computers managed
# by System Center Operations Manager.
# Copyright (c) Microsoft Corporation. All rights reserved.
#]

# DISCLAIMER:
# This script is made available to you without any express, implied or
# statutory warranty, not even the implied warranty of
# merchantability or fitness for a particular purpose, or the
# warranty of title or non-infringement. The entire risk of the
# use or the results from the use of this script remains with you.

$VMMServerComputerName = "YoureSCVMM.YoureADDomain.tut.by"
$RMS = “YoureOpsMgr.YoureADDomain.tut.by”

#
# http://www.thomasmaurer.ch/2010/12/powershell-for-system-center-virtual-machine-manager-and-hyper-v/
#
# Load Powershell Snapin for Virtual Machine Manager:
#

if ((Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SystemCenter.VirtualMachineManager'}) -eq $null)
{
Write-Host("Loading SC VMM PS Snapin")
Add-PSSnapin Microsoft.SystemCenter.VirtualMachineManager
}

#################################
#Init the connection to SCOM srv
#################################

if(-not (Get-pssnapin | Where-Object {$_.Name -eq "Microsoft.EnterpriseManagement.OperationsManager.Client"}))
{
Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client
}
new-managementGroupConnection -ConnectionString:$RMS
Set-Location "OperationsManagerMonitoring::" -ErrorVariable errSnapin ;
Set-Location $RMS -ErrorVariable errSnapin ;

####################################################################
# Connect to the Virtual Machine Manager server
####################################################################
# Substitute the name of your VMM server and domain in this command:
$VMMServerByComputerName = Get-VMMServer -ComputerName $VMMServerComputerName

####################################################################
# Get all computers managed by VMM and get OpsMgr server
####################################################################
# Get the object for all host and library servers and all guest managed by VMM

$VMMManagedComputer = Get-VM

# Get an instance of the OpsMgr Management Server
$OpsMgrServer = Get-ManagementServer

####################################################################
# For each VMM host, ( and may be library server ) and all guest initiate a discovery
####################################################################
ForEach ($Computer in $VMMManagedComputer)
{
Write-Host $Computer.Name
if ( -not ( $Computer.ComputerNameString -eq "Unknown" ) ) {

Write-Host $Computer.ComputerNameString
Write-Host ""

#Create a new discovery configuration
$DiscoveryConfig = New-WindowsDiscoveryConfiguration -ComputerName $Computer.ComputerNameString -ComputerType Server

#Initiate the Operations Manager discovery
$discoResult = Start-Discovery -ManagementServer $OpsMgrServer -WindowsDiscoveryConfiguration $DiscoveryConfig

#Check that the discovery process discovered the Windows computers you specified.
$discoResult.CustomMonitoringObjects

if($discoResult.CustomMonitoringObjects -ne $null)
{
Write-Host "Agent installation in progress..."
Write-Host ""
Install-Agent –ManagementServer $managementServer –AgentManagedComputer $discoResult.CustomMonitoringObjects

Write-host "Installation Finished, waiting for 60 secondes"
Start-Sleep -s 60
}

}

}

Used resources:

http://www.opsmode.com/2009/09/scheduling-opsmgr-powershell-scripts/


#
#Scheduling OpsMgr PowerShell scripts
#2009/09/17, 10:37 When scheduling an Operations Manager PowerShell script you have to load the powershell snapins.
#
#Insert this in the beginning of your script
#
#$ServerName = “hostname”
#add-pssnapin “Microsoft.EnterpriseManagement.OperationsManager.Client”;
#set-location “OperationsManagerMonitoring::”;
#new-managementGroupConnection -ConnectionString:$ServerName;
#set-location $ServerName;
#

#if ((Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.EnterpriseManagement.OperationsManager.Client'}) -eq $null)
# {
## add-pssnapin “Microsoft.EnterpriseManagement.OperationsManager.Client”;
# }

http://www.leveilleur.net/index.php/2010/01/20/opsmgr-scom-automatic-agent-deployment-with-powershell/


#
# Var B
#
##################################
##Init the connection to SCOM srv
##################################
#if(-not (Get-pssnapin | Where-Object {$_.Name -eq "Microsoft.EnterpriseManagement.OperationsManager.Client"}))
# {
# Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client
# }
#new-managementGroupConnection -ConnectionString:$RMS
#Set-Location "OperationsManagerMonitoring::" -ErrorVariable errSnapin ;
#Set-Location $RMS -ErrorVariable errSnapin ;
#

> У части виртуальных серверов состояние . . . Not Monitored.

Например:

Они могут быть не в домене.
Если на виртуальном комп-е ISA Server или TMG, то надо задать в них IP OpsMgr.

Copyright © 2013 Виктор Мясников ( Victor Miasnikov). Search Engine Optimization by Star Nine. Distributed by Wordpress Themes
Хостинг hoster.by   Сервис белорусских блогов: BLOGS.TUT.BY