Search This Blog

Showing posts with label Domino. Show all posts
Showing posts with label Domino. Show all posts

Monday, March 21, 2016

Domino Port Audit

Pretend some server admins were going to change out their IPs from their 208 addresses for some new IPs and you needed to test for connectivity for all the IPs involved; server and services. You may want to do something similar to the following...

## The Scripting Guys Test-Port script
## https://gallery.technet.microsoft.com/scriptcenter/97119ed6-6fb2-446d-98d8-32d823867131

## Pretend I got IBM Domino servers in cluster pairs like this...
 app001/srv/mycompany 10.10.10.23
 app011/srv/mycompany 10.10.10.24
 app021/srv/mycompany 208.109.4.218   # godaddy.com is not my server.
 app022/srv/mycompany 208.109.4.219   # I don't know who this is.
 app002/srv/mycompany 10.10.2.54
 app012/srv/mycompany 10.10.2.55

## From a cmd I can issue these commands and capture the results
ping 10.10.10.23
ping 10.10.10.24
ping 208.109.4.218
ping 208.109.4.219
ping 10.10.2.54
ping 10.10.2.55

tracert 10.10.10.23
tracert 10.10.10.24
tracert 208.109.4.218
tracert 208.109.4.219
tracert 10.10.2.54
tracert 10.10.2.55

## I Want to see the successful connection to the NRPC port
start telnet 10.10.10.23 1352
start telnet 10.10.10.24 1352
start telnet 208.109.4.218 1352
start telnet 208.109.4.219 1352
start telnet 10.10.2.54 1352
start telnet 10.10.2.55 1352

## Domino console batch saved as trace.txt and piped in to the console
trace 10.10.10.23
trace 10.10.10.24
trace 208.109.4.218
trace 208.109.4.219
trace 10.10.2.54
trace 10.10.2.55
## When your done with this you can search the log for messages like...
## Network: 10.10.10.23 is the server address of server CN=app001/OU=srv/O=mycompany
## I typically just search on " is the server address of server CN=" 
## Make sure to include the double quotes.

## Singular test 
$tcpObject = New-Object System.Net.Sockets.TcpClient
$tcpConnect = $tcpObject.BeginConnect('10.10.10.23','1352',$null,$null)
$tcpConnect.AsyncWaitHandle.WaitOne(1000)
$tcpObject.Close()

## playing around
$Server = '10.10.10.23'
$Server = '10.10.10.24'
$Server = '208.109.4.218'
$Server = '208.109.4.219'
$Server = '10.10.2.54'
$Server = '10.10.2.55'

## Lets to a batch
$ServerList = @('10.10.10.23',
                '10.10.10.24',
                '208.109.4.218',
                '208.109.4.219',
                '10.10.2.54',
                '10.10.2.55')
$port=1352
foreach($Server in $ServerList){
   $tcpObject = New-Object System.Net.Sockets.TcpClient
   $tcpConnect = $tcpObject.BeginConnect($Server,$port,$null,$null)
   $wait = $tcpConnect.AsyncWaitHandle.WaitOne(1000)
   ($server+" "+$wait)
   $wait=$null
   $tcpObject.Close()
}
This batch audit at the end creates a result similar to ...
10.10.10.23 True
10.10.10.24 True
208.109.4.218 False
208.109.4.219 False
10.10.2.54 True
10.10.2.55 True

Wednesday, July 22, 2015

Domino Mail Stats with Powershell

I was helping a project team implement ZL Tech's (zlti.com) archiving with folks from Honda (Honda.com) and ViewPointe (Viewpointe.com) and found myself getting metrics every couple of hours. Which got really annoying pretty fast... And, so the following bit of code helped me to let other folks do the same as needed.
Have Fun! : )

The Output...

PS D:\data\scripts\ps-notes> ./MailStats.ps1
Start: 13:09:57.0831

Host            Drive    Size GB    Free GB
=============== ===== ========== ==========
AMnotes01          F:     150.00      28.19

   Mailbox            Size MB  Doc Count
   =============== ========== ==========
   mail1.box           12,336          6
   mail2.box            4,884          4
   mail3.box            4,727          4
   mail4.box            4,651          4
   --------------- ---------- ----------
   Totals              26,598          4

Elapsed Time: 00:00:17.0125

The Code...
## MailStats.ps1
## First Code 07:05:20.0415
## initial runtime 00:00:48.0165
## 
$dtStart = (get-date)
"Start: "+($dtStart.Hour.ToString()).PadLeft(2,"0")+":"+($dtStart.Minute.ToString()).PadLeft(2,"0")+":"+($dtStart.Second.ToString()).PadLeft(2,"0")+"."+($dtStart.Millisecond.ToString()).PadLeft(4,"0")
$StartPath = Get-Location

## Vars to set
$LocalDataDir = 'C:\Program Files (x86)\IBM\Lotus\Notes\Data' ## your local Notes data dir
$DominoServiceName = 'UserSMTPgw01/SRV/AM/MyCompany' ## your Notes/Domino Server
$HostName = 'AMnotes29' ## the host name that the Domino service runs on
$HostDataDir = 'f$\notes\data\' ## the rest of the unc path to the Domino services' data dir 
$HostDataDrive = 'F:' ## drive where the Domino services' data dir is on 

$UNCMailboxPath = '\\'+$HostName+'\'+$HostDataDir+'mail*.box'
$MailBoxes = Get-ChildItem -Path $UNCMailboxPath

Set-Location $LocalDataDir
$Notes = New-Object -ComObject Lotus.NotesSession
$Notes.Initialize()

$HostMBDisk = Get-WmiObject Win32_LogicalDisk -ComputerName $HostName | where {$_.DeviceID -eq 'F:'} | Select-Object Size,FreeSpace

Write-output ""
Write-Output "Host            Drive    Size GB    Free GB"
Write-Output "=============== ===== ========== =========="
Write-Output  ( $HostName.PadRight(15)+' '   `
               +$HostDataDrive.PadLeft(5)+' '    `
               +("{0:N2}" -f ($HostMBDisk.Size/1GB)).ToString().PadLeft(10)+' '   `
               +("{0:N2}" -f ($HostMBDisk.FreeSpace/1GB)).ToString().PadLeft(10))
Write-output ""
Write-Output "   Mailbox            Size MB  Doc Count"
Write-Output "   =============== ========== =========="

$TotSize = 0
$TotDocs = 0

foreach ($mailbox in $MailBoxes) {
   
   $dbMB = $Notes.GetDatabase($DominoServiceName, $mailbox.name.ToString(), 1)

   if ($dbMB -ne $null) {

      $colAllDocs = $dbMB.AllDocuments

      Write-output  ( "   "   `
                      +$mailbox.name.ToString().PadRight(15)+' '   `
                      +("{0:N0}" -f ($dbMB.Size/1MB)).ToString().padleft(10)+' '   `
                      +($colAllDocs.Count.ToString().padleft(10)))
      $TotSize = $TotSize + $dbMB.Size
      $TotDocs = $colAllDocs.Count

      $colAllDocs = $null

   } else {
         
      $strStatus = 'No Mailbox'

   }
      
   $dbMb = $null

}
Write-Output "   --------------- ---------- ----------"
Write-output  ( '   Totals          '   `
               +("{0:N0}" -f ($TotSize/1MB)).ToString().padleft(10)+' '   `
               +($TotDocs.ToString().padleft(10)))

Write-output ""

Set-Location $StartPath
$dtDiff = (New-Timespan -Start $dtStart -End (Get-Date))
"Elapsed Time: "+($dtDiff.Hours.ToString()).PadLeft(2,"0")+":"+($dtDiff.Minutes.ToString()).PadLeft(2,"0")+":"+($dtDiff.Seconds.ToString()).PadLeft(2,"0")+"."+($dtDiff.Milliseconds.ToString()).PadLeft(4,"0")
$TotSize = $null
$TotDocs = $null
$dbMB = $null
$Notes = $null
$StartPath = $null
$dtStart = $null