달력

2

« 2025/2 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
PowerShell을 이용한 Exchange Server의 사서함 사용 현황 리포팅
응용하면 예약 작업 등의 기능을 통해 특정 PowerShell 실행 결과를 관리자에게 메일로 보내는 용도로 사용할 수 있겠다.
Exchange Server 2007에서 테스트 함.
실행 명령줄: PowerShell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\Bin\ExShell.psc1" -Command "C:\<파일 이름>.ps1"

$FromAddress="발신자 메일 주소"
$ToAddress="수신자 메일 주소"
$MessageSubject="사서함 사용 현황"
$MessageBody="ProhibitSend 또는 IssueWarning 상태의 사용자 사서함 현황"
$SendingServer="메일 서버 이름 또는 IP 주소"

$ProhibitSend="C:\ProhibitSend.txt"
$IssueWarning="C:\IssueWarning.txt"

Get-MailboxStatistics | Where { $_.StorageLimitStatus -eq "ProhibitSend" } | Sort-Object DisplayName | ft DisplayName, StorageLimitStatus, ItemCount > $ProhibitSend
Get-MailboxStatistics | Where { $_.StorageLimitStatus -eq "IssueWarning" } | Sort-Object DisplayName | ft DisplayName, StorageLimitStatus, ItemCount > $IssueWarning

$SMTPMessage = New-Object System.Net.Mail.MailMessage $FromAddress, $ToAddress, $MessageSubject, $MessageBody
$Attachment1 = new-object System.Net.Mail.Attachment $ProhibitSend
$SMTPMessage.Attachments.Add($Attachment1)
$Attachment2 = new-object System.Net.Mail.Attachment $IssueWarning
$SMTPMessage.Attachments.Add($Attachment2)
$SMTPClient=New-Object System.Net.Mail.SMTPClient $SendingServer
$SMTPClient.Send($SMTPMessage)
:
Posted by 커널64
2011. 8. 6. 10:18

[SCOM] SCOM 2007 R2 CU5 릴리즈!! SystemCenter2011. 8. 6. 10:18

SCOM 2007 R2 CU5가 릴리즈됐다. 눈이 가는 항목은
- 에이전트 업데이트 시 SCOM과 관련없는 서비스가 재시작되는 문제 해결
- Non-Windows 모니터링 대상에 RHEL 6 지원

릴리즈 노트
http://support.microsoft.com/kb/2495674

다운로드
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=26938

요약
- Restart of non-Operations Manager services when the agent is updated.

- Updated ACS reports.
- TCP Port Probe incorrectly reports negative ping latency.
- MissingEvent Manual Reset Monitor does not work as expected.
- Drillthrough fails because of rsParameterTypeMismatch in the EnterpriseManagementChartControl.
- ACS - Event log message is truncated or corrupted in SCDW.
- UI hang caused by SDK locking.
- ACS Filter fails for certain wildcard queries.
- Edit Schedule button is disabled with SQL 2008 R2.
- Web console times out when you open the left navigation tree.
- Scheduled Reports view for Windows Server 2003 and for Microsoft SQL Server 2005 Reporting Services SP3 CU9 returns "System.IndexOutOfRangeException: Index was outside the bounds of the array."
- Signed MPs cannot be imported when new attributes are added to existing classes.

Cross Platform 모니터링 관리팩 관련
- Performance data for LVM managed partitions is not available.
- Process monitor does not keep name if run by using symbolic link.
- AIX with large number of processes crashes with bad alloc.
- RHEL 6 지원

Cross Platform Monitoring Management Pack 다운로드
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=18891

:
Posted by 커널64

온도 쿼리 ActiveX 개체를 이용해 연속 임계값 초과 비교하는 모니터
SCOM VBS VBScript Operations Manager

' Property[@Name='Status']    Good / Bad
' $Data/Context/Property[@Name='Message']$

' 파라미터로 센서 이름, 비교 횟수, 임계값 제공
Set oArgs = WScript.Arguments
If oArgs.Count <> 3 Then
WScript.Echo "파라미터 오류"
WScript.Echo "파라미터: 센서 이름, 비교 횟수, 임계값"
WScript.Quit
End If
Sensor = oArgs(0)
MonCount = oArgs(1)
Threshold = oArgs(2)

' 로그 파일 위치
strLogDir = "C:\"
strLogFile = strLogDir&Ucase(Sensor)&".Log"

Dim oAPI, oBag
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()

Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strLogFile) Then
Else Set objTextFile = objFSO.CreateTextFile(strLogFile)
End If

' 온도 쿼리
Dim DD, Infos, Temperatures, CurTemp
CurTemp = 0
On Error Resume Next
Set DD = WScript.CreateObject ("Dimensiondata.KR.PS.MSFT.DDHMon.HWMonitor")
If Err.Number <> 0 Then
WScript.Echo Err.Description
WScript.Quit
End If

Infos = DD.GetHWTemperature()
Temperatures = Split(infos, "|")
For i = 0 to UBound(Temperatures)-1
Temp = Split(Temperatures(i), ",")
If inStr(Ucase(Temp(1)),Ucase(Sensor)) Then
If CurTemp < Temp(2) Then
CurTemp = Temp(2)
End If
strDevice = Temp(0)
strSensor = Temp(1)
End If
Next
Set DD = Nothing

' 로그 파일에 기록
On Error Resume Next
Set objTextFile = objFSO.OpenTextFile(strLogFile, ForReading)
FirstLine = objTextFile.ReadLine & CurTemp & "|"
If Err.Number <> 0 Then
FirstLine = CurTemp & "|"
End If
arrTemp = Split(FirstLine,"|")

If cInt(UBound(arrTemp)) > cInt(MonCount) Then
FirstLine = ""
For i=0 To MonCount-2
arrTemp(i) = arrTemp(i+1)
FirstLine = FirstLine & arrTemp(i) & "|"
Next
FirstLine = FirstLine & CurTemp & "|"
End If
Set objTextFile = objFSO.OpenTextFile(strLogFile, ForWriting)
objTextFile.Write(FirstLine)
objTextFile.Close
Set objFSO = Nothing

' 임계치 비교
arrTemp = Split(FirstLine,"|")
OverCount = 0
For i =0 To Ubound(arrTemp)-1
If cInt(arrTemp(i)) > cInt(Threshold) Then
OverCount = OverCount + 1
End If
Next

' 결과 리턴
If cInt(OverCount) >= cInt(MonCount) Then
Call oBag.AddValue("Status","Bad")
Call oBag.AddValue("Message","Device("&strDevice&") temperature is over threshold("&Threshold&"). Current temperature is "&arrTemp(Ubound(arrTemp)-1)&".")
Call oAPI.Return(oBag)
Else Call oBag.AddValue("Status","Good")
Call oBag.AddValue("Message","Devices temperature is below threshold.")
Call oAPI.Return(oBag)
End If

:
Posted by 커널64

스크립트로 단일 임계값 비교가 아닌 다수의 임계값 비교가 필요한 경우 VBS VBScript
파일로 이전 수집 값을 기록했다가 샘플링 횟수와 임계치 비교
예를 들면, 5회 수집 후 5회 연속 임계값 초과 시 등등

' 파라미터로 비교 횟수, 임계값 제공
Set oArgs = WScript.Arguments
MonCount = oArgs(0)
Threshold = oArgs(1)

' 로그 파일 위치
strLogFile = "C:\TEST.Log"

Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strLogFile) Then
Else Set objTextFile = objFSO.CreateTextFile(strLogFile)
End If


' 값 가져오는 로직 추가
' CurTemp = XXXX


On Error Resume Next
Set objTextFile = objFSO.OpenTextFile(strLogFile, ForReading)
FirstLine = objTextFile.ReadLine & CurTemp & "|"
If Err.Number <> 0 Then
FirstLine = CurTemp & "|"
End If
arrTemp = Split(FirstLine,"|")

If cInt(UBound(arrTemp)) > cInt(MonCount) Then
FirstLine = ""
For i=0 To MonCount-2
arrTemp(i) = arrTemp(i+1)
FirstLine = FirstLine & arrTemp(i) & "|"
Next
FirstLine = FirstLine & CurTemp & "|"
End If
Set objTextFile = objFSO.OpenTextFile(strLogFile, ForWriting)
objTextFile.Write(FirstLine)
objTextFile.Close
Set objFSO = Nothing

' 임계치 비교
arrTemp = Split(FirstLine,"|")
OverCount = 0
For i =0 To Ubound(arrTemp)-1
If cInt(arrTemp(i)) > cInt(Threshold) Then
OverCount = OverCount + 1
End If
Next

If cInt(OverCount) > 0 Then
WScript.Echo "샘플링 수: "& MonCount & ", 초과 수: " & OverCount
Else WScript.Echo "임계값 초과 안 함"
End If

:
Posted by 커널64
2011. 7. 29. 12:47

[SCOM] SCOM 2012 Beta 설치 SystemCenter2011. 7. 29. 12:47

SCOM 2012 Beta 설치

요구 사항
- Windows Server 2008 R2
- SQL 2008 SP1 이상
- SQL Components: DB Engine, Full Text Search, Reporting
- SQL Collation: SQL_Latin1_General_CP1_CI_AS

에이전트 운영체제(Windows)
- Windows Server 2003 SP2
- Windows Server 2008 SP2
- Windows Server 2008 R2
- Windows XP Professional SP3
- Windows Vista SP2
- Windows 7

에이전트 운영체제(Non-Windows)
- Red Hat Enterprise Linux 4, 5, 6 (x86/x64)
- SUSE Linux Enterprise Server 9 (x86), 10 SP1 (x86/x64), 11 (x86/x64)
- Solaris 8, 9 (SPARC), Solaris 10 (SPARC/x86)
- HP-UX 11i v2, v3 (PA-RISC/IA64)
- AIX 5.3, 6.1, 7.1 (POWER)

설치 중 관리자 그룹을 입력하는 부분이 빠진 것과 OperationsManager DB와 DW DB를 동시에 설치할 수 있다는 것 외에 별 다른 특이 사항은 없다. 내부적으로는 RMS가 없어지고 모든 MS에서 SDK 서비스가 실행된다. 아~주 반가운 소식이다. 더 이상 시스템의 고가용성 구성을 위해 고민하지 않아도 되겠다.
관리 콘솔에서의 큰 변화는 없으며 대시보드 뷰의 기능(?)이 좋아 졌고, Network 모니터링에 대한 관리 서버의 풀 기능과 관리팩 템플릿에서 .NET 응용 프로그램 성능 모니터링이 추가됐다.
일단 간단하게 살펴본 바로는 모니터나 규칙에서 Syslog 규칙 외에 추가된 부분은 보이지 않는다.

:
Posted by 커널64
2011. 7. 12. 15:23

VMMSSP 2.0 SP1 릴리즈 소식 Virtualization2011. 7. 12. 15:23

VMMSSP (Virtual Machine Manager Self Service Portal) 2.0 SP1이 릴리즈되었다.

다운로드 링크
http://www.microsoft.com/download/en/details.aspx?id=26701

퀵! 스타트 가이드~
http://technet.microsoft.com/en-us/library/gg588340.aspx

:
Posted by 커널64
2011. 6. 14. 20:38

[VBS] VBS를 통한 MySQL 쿼리 Etc.2011. 6. 14. 20:38

VBS VBScript MySQL
VBS를 통한 MySQL 쿼리, 이전에 먼저 MySQL ODBC Connector를 설치하여야 한다.
http://www.mysql.com/downloads/connector/odbc/

USER = "root"
PASSWORD = "Password"
SQLQUERY = "Show Variables"

ConnString = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;USER="&USER&";PASSWORD="&PASSWORD
Set Connection = CreateObject("ADODB.Connection")
Set Recordset = CreateObject("ADODB.Recordset")
Connection.Open ConnString
Recordset.Open SQLQUERY,Connection

If Recordset.EOF Then
WScript.Echo "No rows returned."
WScript.Quit
Else
Do While NOT Recordset.EOF
WScript.Echo Recordset(0), Recordset(1)
Recordset.MoveNext
Loop
End If

Recordset.Close
Set Recordset=nothing
Connection.Close
Set Connection=nothing

:
Posted by 커널64

VBS VBScript EventLog EventID
Security Event Log를 이벤트 ID로 필터링해 원격 서버에 저장하고 로컬 서버에는 전체 이벤트 로그를 Export해 저장한다. 저장이 끝난 후 이벤트 로그를 비운다.

' ------------------------------------------------------------------
' ------------------------------------------------------------------
' --------- Filtering by Event ID (Comma Separated)
EventID = "528,529,540,4624,4625"

' --------- Local Store
LocalDir = "C:\SecurityEvent"

' --------- Destination
ServerShare = \\123.123.123.123\FileShare
UserName = "Domain\User"
Password = "Password"
' ------------------------------------------------------------------
' ------------------------------------------------------------------


' --------- Start Script
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(Security)}!\\.\root\cimv2")
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set NetworkObject = CreateObject("WScript.Network")
If  Not FileSystem.FolderExists(LocalDir) Then
Createfolder = FileSystem.CreateFolder (LocalDir)
End If

EventIDFilter = ""
arrEventID = Split(EventID,",")
For Each EventID in arrEventID
EventIDFilter = EventIDFilter & "EventCode=" & Trim(EventID) & " OR "
Next
EventIDFilter = Left(EventIDFilter,Len(EventIDFilter)-4)

If Right(LocalDir,1) <> "\" Then
LocalDir = LocalDir & "\"
End If
If Right(ServerShare,1) <> "\" Then
ServerShare = ServerShare & "\"
End If

Set colOS = objWMIService.ExecQuery ("Select * From Win32_OperatingSystem")
For Each OSInfo in colOS
HostName = OSInfo.CSName
Next
Set colOS = Nothing
LogFileName = HostName & "-" & Year(Date) & Month(Date) & Day(Date) & "-" & "SecurityLog.csv"
LogFileFullPath = LocalDir & LogFileName

NetworkObject.MapNetworkDrive "", Left(ServerShare,Len(ServerShare)-1), False, UserName, Password
Set colLoggedEvents = objWMIService.ExecQuery ("Select * From Win32_NTLogEvent Where Logfile = 'Security' AND (" & EventIDFilter & ")")
Set oFile = FileSystem.CreateTextFile(LogFileFullPath, True)

oFile.WriteLine ("EventType,EventID,Date,Time,Description")
For Each objEvent in colLoggedEvents
strDateTime = DateAdd("h",9,WMIDateStringToDate(objEvent.TimeGenerated))
strDate = FormatDateTime(strDateTime,2)
strTime = FormatDateTime(strDateTime,3)
strDescription = ""
arrDescription = Split(objEvent.Message,vbCRLF)
For Each objDescription in arrDescription
If InStr(objDescription,"계정 이름:") OR InStr(objDescription,"로그온 유형:") OR InStr(objDescription,"워크스테이션 이름:") OR InStr(objDescription,"원본 네트워크 주소:") _
OR InStr(objDescription,"User Name:") OR InStr(objDescription,"Account Name:") OR InStr(objDescription,"Logon Type:") OR InStr(objDescription,"Workstation Name:") OR InStr(objDescription,"Source Network Address:") Then
strDescription = strDescription & Replace(objDescription,vbTab,"") & " "
End If
Next
oFile.WriteLine (objEvent.Type&","&objEvent.EventCode&","&strDate&","&strTime&","&strDescription)
Next

oFile.Close
Set colLoggedEvents = Nothing
If (FileSystem.FileExists(ServerShare & LogFileName)) Then
Set aFile = FileSystem.GetFile(ServerShare & LogFileName)
aFile.Delete
End If
FileSystem.MoveFile LogFileFullPath, ServerShare & LogFileName
NetworkObject.RemoveNetworkDrive Left(ServerShare,Len(ServerShare)-1), True, False

If (FileSystem.FileExists(LocalDir & HostName & "-" & Year(Date) & Month(Date) & Day(Date) & "-" & "SecurityLog.evt")) Then
Set bFile = FileSystem.GetFile(LocalDir & HostName & "-" & Year(Date) & Month(Date) & Day(Date) & "-" & "SecurityLog.evt")
bFile.Delete
End If
Set objWMIService2 = GetObject("winmgmts:{impersonationLevel=impersonate,(Backup)}!\\.\root\cimv2")
Set colLogFiles = objWMIService2.ExecQuery("Select * from Win32_NTEventLogFile Where LogFileName='Security'")
For Each objLogfile in colLogFiles
objLogFile.BackupEventLog(LocalDir & HostName & "-" & Year(Date) & Month(Date) & Day(Date) & "-" & "SecurityLog.evt")
objLogFile.ClearEventLog()
Next

Set colLogFiles = Nothing
Set objWMIService = Nothing
Set objWMIService2 = Nothing
Set NetworkObject = Nothing
Set FileSystem  = Nothing

Function WMIDateStringToDate(dtmInstallDate)
WMIDateStringToDate = CDate(Mid(dtmInstallDate, 5, 2) & "/" & Mid(dtmInstallDate, 7, 2) & "/" & Left(dtmInstallDate, 4) & " " & Mid (dtmInstallDate, 9, 2) & ":" &Mid(dtmInstallDate, 11, 2) & ":" & Mid(dtmInstallDate, 13, 2))
End Function

:
Posted by 커널64

SCCM의 Asset Intelligence 라이선스 정보 Import 및 Reporting

Name,Publisher,Version,Language,EffectiveQuantity,PONumber,ResellerName,DateOfPurchase,SupportPurchased,SupportExpirationDate,Comments
위와 같은 컬럼 값을 가지는 CSV 파일을 생성한 후 SCCM 콘솔에서 Import 한다.
만약, 라이선스 정보가 바뀌었거나 DB에서 제거하고 싶은 경우 빈 파일을 가져오거나, 변경된 정보를 가지고 있는 CSV 파일을 다시 불러오면 된다.

가져온 라이선스 대비 설치된 소프트웨어 현황 비교는 License 15A - General License Reconciliation Report 를 통해 확인 가능하다.



[샘플 파일]

:
Posted by 커널64

SCCM Asset Intelligence Catalog Sync 오류 'Connection failed - bad certificate'

SCCM 2007 SP2 상태에서 Asset Intelligence Catalog Sync 역할 설치 후 초기 동기화 시 다음 오류가 발생한다.



SCCM 서버의 로그 파일을 보면 다음 오류가 기록된다.

Asset Intelligence Catalog Sync Service Warning: 0 : Mon, 30 May 2011 05:39:48 GMT:WebException trying to enroll: Status = ProtocolError
Asset Intelligence Catalog Sync Service Error: 0 : Mon, 30 May 2011 05:39:48 GMT:Exception attempting sync - HTTP 상태 403: Forbidden(으)로 인해 요청하지 못했습니다.

참고 KB
http://support.microsoft.com/kb/2483225/en-us

:
Posted by 커널64